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 | |
11 | #ifndef BOOST_TT_ADD_CV_HPP_INCLUDED |
12 | #define BOOST_TT_ADD_CV_HPP_INCLUDED |
13 | |
14 | #include <boost/config.hpp> |
15 | |
16 | namespace boost { |
17 | |
18 | // * convert a type T to a const volatile type - add_cv<T> |
19 | // this is not required since the result is always |
20 | // the same as "T const volatile", but it does suppress warnings |
21 | // from some compilers: |
22 | |
23 | #if defined(BOOST_MSVC) |
24 | // This bogus warning will appear when add_volatile is applied to a |
25 | // const volatile reference because we can't detect const volatile |
26 | // references with MSVC6. |
27 | # pragma warning(push) |
28 | # pragma warning(disable:4181) // warning C4181: qualifier applied to reference type ignored |
29 | #endif |
30 | |
31 | template <class T> struct add_cv{ typedef T const volatile type; }; |
32 | |
33 | #if defined(BOOST_MSVC) |
34 | # pragma warning(pop) |
35 | #endif |
36 | |
37 | template <class T> struct add_cv<T&>{ typedef T& type; }; |
38 | |
39 | #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) |
40 | |
41 | template <class T> using add_cv_t = typename add_cv<T>::type; |
42 | |
43 | #endif |
44 | |
45 | } // namespace boost |
46 | |
47 | #endif // BOOST_TT_ADD_CV_HPP_INCLUDED |
48 | |