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_IMPL_VALUE_REF_HPP
10  
#ifndef BOOST_JSON_IMPL_VALUE_REF_HPP
11  
#define BOOST_JSON_IMPL_VALUE_REF_HPP
11  
#define BOOST_JSON_IMPL_VALUE_REF_HPP
12  

12  

 
13 +
#include <boost/json/value_from.hpp>
 
14 +

13  
namespace boost {
15  
namespace boost {
14  
namespace json {
16  
namespace json {
15  

17  

16  
template<class T>
18  
template<class T>
17  
value
19  
value
18 -
value_ref::
20 +
value_ref::from_builtin(void const* p, storage_ptr sp) noexcept
19 -
from_builtin(
 
20 -
    void const* p,
 
21 -
    storage_ptr sp) noexcept
 
22  
{
21  
{
23 -
    return value(
22 +
    return value( *reinterpret_cast<T const*>(p), std::move(sp) );
24 -
        *reinterpret_cast<
 
25 -
            T const*>(p),
 
26 -
        std::move(sp));
 
27  
}
23  
}
28  

24  

29  
template<class T>
25  
template<class T>
30  
value
26  
value
31 -
value_ref::
27 +
value_ref::from_const(void const* p, storage_ptr sp)
32 -
from_const(
 
33 -
    void const* p,
 
34 -
    storage_ptr sp)
 
35  
{
28  
{
36 -
    return value(
29 +
    return value_from( *reinterpret_cast<T const*>(p), std::move(sp) );
37 -
        *reinterpret_cast<
 
38 -
            T const*>(p),
 
39 -
        std::move(sp));
 
40  
}
30  
}
41  

31  

42  
template<class T>
32  
template<class T>
43  
value
33  
value
44 -
value_ref::
34 +
value_ref::from_rvalue(void* p, storage_ptr sp)
45 -
from_rvalue(
 
46 -
    void* p,
 
47 -
    storage_ptr sp)
 
48  
{
35  
{
49 -
    return value(
36 +
    return value_from( std::move(*reinterpret_cast<T*>(p)), std::move(sp) );
50 -
        std::move(
 
51 -
            *reinterpret_cast<T*>(p)),
 
52 -
        std::move(sp));
 
53  
}
37  
}
54  

38  

55  
} // namespace json
39  
} // namespace json
56  
} // namespace boost
40  
} // namespace boost
57  

41  

58  
#endif
42  
#endif