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>
13  
#include <boost/json/value_from.hpp>
14  

14  

15  
namespace boost {
15  
namespace boost {
16  
namespace json {
16  
namespace json {
17  

17  

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

24  

25  
template<class T>
25  
template<class T>
26  
value
26  
value
27  
value_ref::from_const(void const* p, storage_ptr sp)
27  
value_ref::from_const(void const* p, storage_ptr sp)
28  
{
28  
{
29  
    return value_from( *reinterpret_cast<T const*>(p), std::move(sp) );
29  
    return value_from( *reinterpret_cast<T const*>(p), std::move(sp) );
30  
}
30  
}
31  

31  

32  
template<class T>
32  
template<class T>
33  
value
33  
value
34  
value_ref::from_rvalue(void* p, storage_ptr sp)
34  
value_ref::from_rvalue(void* p, storage_ptr sp)
35  
{
35  
{
36  
    return value_from( std::move(*reinterpret_cast<T*>(p)), std::move(sp) );
36  
    return value_from( std::move(*reinterpret_cast<T*>(p)), std::move(sp) );
37  
}
37  
}
38  

38  

39  
} // namespace json
39  
} // namespace json
40  
} // namespace boost
40  
} // namespace boost
41  

41  

42  
#endif
42  
#endif