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 void type; };
53template <> struct add_reference<const volatile void> { typedef void type; };
54template <> struct add_reference<volatile void> { typedef void type; };
55#endif
56
57} // namespace boost
58
59#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
60

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