1 | /* |
---|---|
2 | Copyright 2019 Glen Joseph Fernandes |
3 | (glenjofe@gmail.com) |
4 | |
5 | Distributed under the Boost Software License, |
6 | Version 1.0. (See accompanying file LICENSE_1_0.txt |
7 | or copy at http://www.boost.org/LICENSE_1_0.txt) |
8 | */ |
9 | #ifndef BOOST_TT_COPY_REFERENCE_HPP_INCLUDED |
10 | #define BOOST_TT_COPY_REFERENCE_HPP_INCLUDED |
11 | |
12 | #include <boost/type_traits/add_lvalue_reference.hpp> |
13 | #include <boost/type_traits/add_rvalue_reference.hpp> |
14 | #include <boost/type_traits/is_lvalue_reference.hpp> |
15 | #include <boost/type_traits/is_rvalue_reference.hpp> |
16 | #include <boost/type_traits/conditional.hpp> |
17 | |
18 | namespace boost { |
19 | |
20 | template<class T, class U> |
21 | struct copy_reference { |
22 | typedef typename conditional<is_rvalue_reference<U>::value, |
23 | typename add_rvalue_reference<T>::type, |
24 | typename conditional<is_lvalue_reference<U>::value, |
25 | typename add_lvalue_reference<T>::type, T>::type>::type type; |
26 | }; |
27 | |
28 | #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) |
29 | template<class T, class U> |
30 | using copy_reference_t = typename copy_reference<T, U>::type; |
31 | #endif |
32 | |
33 | } /* boost */ |
34 | |
35 | #endif |
36 |