| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) | ||
| 3 | // | ||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
| 6 | // | ||
| 7 | // Official repository: https://github.com/boostorg/json | ||
| 8 | // | ||
| 9 | |||
| 10 | #ifndef BOOST_JSON_DETAIL_IMPL_DEFAULT_RESOURCE_IPP | ||
| 11 | #define BOOST_JSON_DETAIL_IMPL_DEFAULT_RESOURCE_IPP | ||
| 12 | |||
| 13 | #include <boost/json/detail/default_resource.hpp> | ||
| 14 | |||
| 15 | namespace boost { | ||
| 16 | namespace json { | ||
| 17 | namespace detail { | ||
| 18 | |||
| 19 | #ifndef BOOST_JSON_WEAK_CONSTINIT | ||
| 20 | # ifndef BOOST_JSON_NO_DESTROY | ||
| 21 | BOOST_JSON_REQUIRE_CONST_INIT | ||
| 22 | default_resource::holder | ||
| 23 | default_resource::instance_; | ||
| 24 | # else | ||
| 25 | BOOST_JSON_REQUIRE_CONST_INIT | ||
| 26 | default_resource | ||
| 27 | default_resource::instance_; | ||
| 28 | # endif | ||
| 29 | #endif | ||
| 30 | |||
| 31 | // this is here so that ~memory_resource | ||
| 32 | // is emitted in the library instead of | ||
| 33 | // the user's TU. | ||
| 34 | ✗ | default_resource:: | |
| 35 | ~default_resource() = default; | ||
| 36 | |||
| 37 | void* | ||
| 38 | 264175 | default_resource:: | |
| 39 | do_allocate( | ||
| 40 | std::size_t n, | ||
| 41 | std::size_t) | ||
| 42 | { | ||
| 43 | 264175 | return ::operator new(n); | |
| 44 | } | ||
| 45 | |||
| 46 | void | ||
| 47 | 264175 | default_resource:: | |
| 48 | do_deallocate( | ||
| 49 | void* p, | ||
| 50 | std::size_t, | ||
| 51 | std::size_t) | ||
| 52 | { | ||
| 53 | 264175 | ::operator delete(p); | |
| 54 | 264175 | } | |
| 55 | |||
| 56 | bool | ||
| 57 | 23 | default_resource:: | |
| 58 | do_is_equal( | ||
| 59 | memory_resource const& mr) const noexcept | ||
| 60 | { | ||
| 61 | 23 | return this == &mr; | |
| 62 | } | ||
| 63 | |||
| 64 | } // detail | ||
| 65 | } // namespace json | ||
| 66 | } // namespace boost | ||
| 67 | |||
| 68 | #endif | ||
| 69 |