Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:58

0001 //
0002 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/json
0008 //
0009 
0010 #ifndef BOOST_JSON_DETAIL_IMPL_DEFAULT_RESOURCE_IPP
0011 #define BOOST_JSON_DETAIL_IMPL_DEFAULT_RESOURCE_IPP
0012 
0013 #include <boost/json/detail/default_resource.hpp>
0014 
0015 namespace boost {
0016 namespace json {
0017 namespace detail {
0018 
0019 #ifndef BOOST_JSON_WEAK_CONSTINIT
0020 # ifndef BOOST_JSON_NO_DESTROY
0021 BOOST_JSON_REQUIRE_CONST_INIT
0022 default_resource::holder
0023 default_resource::instance_;
0024 # else
0025 BOOST_JSON_REQUIRE_CONST_INIT
0026 default_resource
0027 default_resource::instance_;
0028 # endif
0029 #endif
0030 
0031 // this is here so that ~memory_resource
0032 // is emitted in the library instead of
0033 // the user's TU.
0034 default_resource::
0035 ~default_resource() = default;
0036 
0037 void*
0038 default_resource::
0039 do_allocate(
0040     std::size_t n,
0041     std::size_t)
0042 {
0043     return ::operator new(n);
0044 }
0045 
0046 void
0047 default_resource::
0048 do_deallocate(
0049     void* p,
0050     std::size_t,
0051     std::size_t)
0052 {
0053     ::operator delete(p);
0054 }
0055 
0056 bool
0057 default_resource::
0058 do_is_equal(
0059     memory_resource const& mr) const noexcept
0060 {
0061     return this == &mr;
0062 }
0063 
0064 } // detail
0065 } // namespace json
0066 } // namespace boost
0067 
0068 #endif