1
2// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
3// Use, modification and distribution are subject to the Boost Software License,
4// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt).
6//
7// See http://www.boost.org/libs/type_traits for most recent version including documentation.
8
9#ifndef BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
10#define BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
11
12#include <boost/type_traits/is_reference.hpp>
13#include <boost/detail/workaround.hpp>
14#include <boost/config.hpp>
15
16// should be the last #include
17#include <boost/type_traits/detail/type_trait_def.hpp>
18
19namespace boost {
20
21namespace detail {
22
23//
24// We can't filter out rvalue_references at the same level as
25// references or we get ambiguities from msvc:
26//
27
28template <typename T>
29struct add_reference_rvalue_layer
30{
31 typedef T& type;
32};
33
34#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
35template <typename T>
36struct add_reference_rvalue_layer<T&&>
37{
38 typedef T&& type;
39};
40#endif
41
42template <typename T>
43struct add_reference_impl
44{
45 typedef typename add_reference_rvalue_layer<T>::type type;
46};
47
48BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&)
49
50// these full specialisations are always required:
51BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void,void)
52#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
53BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const,void const)
54BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void volatile,void volatile)
55BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const volatile,void const volatile)
56#endif
57
58} // namespace detail
59
60BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,typename boost::detail::add_reference_impl<T>::type)
61
62// agurt, 07/mar/03: workaround Borland's ill-formed sensitivity to an additional
63// level of indirection, here
64#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
65BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&)
66#endif
67
68} // namespace boost
69
70#include <boost/type_traits/detail/type_trait_undef.hpp>
71
72#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
73