/src/boost/boost/json/detail/impl/array.hpp
Line | Count | 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_ARRAY_HPP |
11 | | #define BOOST_JSON_DETAIL_IMPL_ARRAY_HPP |
12 | | |
13 | | namespace boost { |
14 | | namespace json { |
15 | | namespace detail { |
16 | | |
17 | | unchecked_array:: |
18 | | ~unchecked_array() |
19 | 24.1k | { |
20 | 24.1k | if(! data_ || |
21 | 5.96k | sp_.is_not_shared_and_deallocate_is_trivial()) |
22 | 23.2k | return; |
23 | 902 | for(unsigned long i = 0; |
24 | 902 | i < size_; ++i) |
25 | 0 | data_[i].~value(); |
26 | 902 | } |
27 | | |
28 | | void |
29 | | unchecked_array:: |
30 | | relocate(value* dest) noexcept |
31 | 18.2k | { |
32 | 18.2k | if(size_ > 0) |
33 | 18.2k | std::memcpy( |
34 | 18.2k | static_cast<void*>(dest), |
35 | 18.2k | data_, size_ * sizeof(value)); |
36 | 18.2k | data_ = nullptr; |
37 | 18.2k | } |
38 | | |
39 | | } // detail |
40 | | } // namespace json |
41 | | } // namespace boost |
42 | | |
43 | | #endif |