]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
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_IMPL_VALUE_REF_HPP | |
11 | #define BOOST_JSON_IMPL_VALUE_REF_HPP | |
12 | ||
13 | #include <boost/json/value_from.hpp> | |
14 | ||
15 | BOOST_JSON_NS_BEGIN | |
16 | ||
17 | template<class T> | |
18 | value | |
19 | value_ref:: | |
20 | from_builtin( | |
21 | void const* p, | |
22 | storage_ptr sp) noexcept | |
23 | { | |
24 | return value( | |
25 | *reinterpret_cast< | |
26 | T const*>(p), | |
27 | std::move(sp)); | |
28 | } | |
29 | ||
30 | template<class T> | |
31 | value | |
32 | value_ref:: | |
33 | from_const( | |
34 | void const* p, | |
35 | storage_ptr sp) | |
36 | { | |
37 | return value_from( | |
38 | *reinterpret_cast< | |
39 | T const*>(p), | |
40 | std::move(sp)); | |
41 | } | |
42 | ||
43 | template<class T> | |
44 | value | |
45 | value_ref:: | |
46 | from_rvalue( | |
47 | void* p, | |
48 | storage_ptr sp) | |
49 | { | |
50 | return value_from( | |
51 | std::move( | |
52 | *reinterpret_cast<T*>(p)), | |
53 | std::move(sp)); | |
54 | } | |
55 | ||
56 | BOOST_JSON_NS_END | |
57 | ||
58 | #endif |