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_REMOVE_REFERENCE_HPP_INCLUDED
10#define BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED
11
12#include <boost/config.hpp>
13#include <boost/detail/workaround.hpp>
14
15namespace boost {
16
17
18namespace detail{
19//
20// We can't filter out rvalue_references at the same level as
21// references or we get ambiguities from msvc:
22//
23template <class T>
24struct remove_rvalue_ref
25{
26 typedef T type;
27};
28#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
29template <class T>
30struct remove_rvalue_ref<T&&>
31{
32 typedef T type;
33};
34#endif
35
36} // namespace detail
37
38template <class T> struct remove_reference{ typedef typename boost::detail::remove_rvalue_ref<T>::type type; };
39template <class T> struct remove_reference<T&>{ typedef T type; };
40
41#if defined(BOOST_ILLEGAL_CV_REFERENCES)
42// these are illegal specialisations; cv-qualifies applied to
43// references have no effect according to [8.3.2p1],
44// C++ Builder requires them though as it treats cv-qualified
45// references as distinct types...
46template <class T> struct remove_reference<T&const>{ typedef T type; };
47template <class T> struct remove_reference<T&volatile>{ typedef T type; };
48template <class T> struct remove_reference<T&const volatile>{ typedef T type; };
49#endif
50
51#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
52
53 template <class T> using remove_reference_t = typename remove_reference<T>::type;
54
55#endif
56
57} // namespace boost
58
59#endif // BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED
60

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