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