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/detail/workaround.hpp>
13#include <boost/config.hpp>
14
15namespace boost {
16
17namespace detail {
18
19//
20// We can't filter out rvalue_references at the same level as
21// references or we get ambiguities from msvc:
22//
23
24template <typename T>
25struct add_reference_impl
26{
27 typedef T& type;
28};
29
30#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
31template <typename T>
32struct add_reference_impl<T&&>
33{
34 typedef T&& type;
35};
36#endif
37
38} // namespace detail
39
40template <class T> struct add_reference
41{
42 typedef typename boost::detail::add_reference_impl<T>::type type;
43};
44template <class T> struct add_reference<T&>
45{
46 typedef T& type;
47};
48
49// these full specialisations are always required:
50template <> struct add_reference<void> { typedef void type; };
51#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
52template <> struct add_reference<const void> { typedef const void type; };
53template <> struct add_reference<const volatile void> { typedef const volatile void type; };
54template <> struct add_reference<volatile void> { typedef volatile void type; };
55#endif
56
57#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
58
59template <class T> using add_reference_t = typename add_reference<T>::type;
60
61#endif
62
63
64} // namespace boost
65
66#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
67

source code of include/boost/type_traits/add_reference.hpp