100.00% Lines (15/15) 100.00% Functions (2/2)
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_ARRAY_HPP 10   #ifndef BOOST_JSON_DETAIL_IMPL_ARRAY_HPP
11   #define BOOST_JSON_DETAIL_IMPL_ARRAY_HPP 11   #define BOOST_JSON_DETAIL_IMPL_ARRAY_HPP
12   12  
13   namespace boost { 13   namespace boost {
14   namespace json { 14   namespace json {
15   namespace detail { 15   namespace detail {
16   16  
HITCBC 17   2120 unchecked_array:: 17   2120 unchecked_array::
HITCBC 18   854 ~unchecked_array() 18   854 ~unchecked_array()
19   { 19   {
HITCBC 20   2977 if(! data_ || 20   2977 if(! data_ ||
HITCBC 21   857 sp_.is_not_shared_and_deallocate_is_trivial()) 21   857 sp_.is_not_shared_and_deallocate_is_trivial())
HITCBC 22   1266 return; 22   1266 return;
HITCBC 23   919 for(unsigned long i = 0; 23   919 for(unsigned long i = 0;
HITCBC 24   919 i < size_; ++i) 24   919 i < size_; ++i)
HITCBC 25   65 data_[i].~value(); 25   65 data_[i].~value();
HITCBC 26   2120 } 26   2120 }
27   27  
28   void 28   void
HITCBC 29   1263 unchecked_array:: 29   1263 unchecked_array::
30   relocate(value* dest) noexcept 30   relocate(value* dest) noexcept
31   { 31   {
HITCBC 32   1263 if(size_ > 0) 32   1263 if(size_ > 0)
HITCBC 33   1263 std::memcpy( 33   1263 std::memcpy(
34   static_cast<void*>(dest), 34   static_cast<void*>(dest),
HITCBC 35   1263 data_, size_ * sizeof(value)); 35   1263 data_, size_ * sizeof(value));
HITCBC 36   1263 data_ = nullptr; 36   1263 data_ = nullptr;
HITCBC 37   1263 } 37   1263 }
38   38  
39   } // detail 39   } // detail
40   } // namespace json 40   } // namespace json
41   } // namespace boost 41   } // namespace boost
42   42  
43   #endif 43   #endif