1 | |
2 | // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard |
3 | // Hinnant & John Maddock 2000. |
4 | // Use, modification and distribution are subject to the Boost Software License, |
5 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
6 | // http://www.boost.org/LICENSE_1_0.txt). |
7 | // |
8 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. |
9 | |
10 | #ifndef BOOST_TT_ADD_CONST_HPP_INCLUDED |
11 | #define BOOST_TT_ADD_CONST_HPP_INCLUDED |
12 | |
13 | #include <boost/type_traits/detail/config.hpp> |
14 | |
15 | namespace boost { |
16 | |
17 | // * convert a type T to const type - add_const<T> |
18 | // this is not required since the result is always |
19 | // the same as "T const", but it does suppress warnings |
20 | // from some compilers: |
21 | |
22 | #if defined(BOOST_MSVC) |
23 | // This bogus warning will appear when add_const is applied to a |
24 | // const volatile reference because we can't detect const volatile |
25 | // references with MSVC6. |
26 | # pragma warning(push) |
27 | # pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored |
28 | #endif |
29 | |
30 | template <class T> struct add_const |
31 | { |
32 | typedef T const type; |
33 | }; |
34 | |
35 | #if defined(BOOST_MSVC) |
36 | # pragma warning(pop) |
37 | #endif |
38 | |
39 | template <class T> struct add_const<T&> |
40 | { |
41 | typedef T& type; |
42 | }; |
43 | |
44 | #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) |
45 | |
46 | template <class T> using add_const_t = typename add_const<T>::type; |
47 | |
48 | #endif |
49 | |
50 | } // namespace boost |
51 | |
52 | #endif // BOOST_TT_ADD_CONST_HPP_INCLUDED |
53 | |