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_REMOVE_VOLATILE_HPP_INCLUDED |
12 | #define BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED |
13 | |
14 | #include <boost/type_traits/is_const.hpp> |
15 | #include <boost/type_traits/detail/cv_traits_impl.hpp> |
16 | #include <boost/config.hpp> |
17 | #include <boost/detail/workaround.hpp> |
18 | |
19 | #include <cstddef> |
20 | |
21 | // should be the last #include |
22 | #include <boost/type_traits/detail/type_trait_def.hpp> |
23 | |
24 | namespace boost { |
25 | |
26 | |
27 | namespace detail { |
28 | |
29 | template <typename T, bool is_const> |
30 | struct remove_volatile_helper |
31 | { |
32 | typedef T type; |
33 | }; |
34 | |
35 | template <typename T> |
36 | struct remove_volatile_helper<T,true> |
37 | { |
38 | typedef T const type; |
39 | }; |
40 | |
41 | template <typename T> |
42 | struct remove_volatile_impl |
43 | { |
44 | typedef typename remove_volatile_helper< |
45 | typename cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::unqualified_type |
46 | , ::boost::is_const<T>::value |
47 | >::type type; |
48 | }; |
49 | |
50 | // |
51 | // We can't filter out rvalue_references at the same level as |
52 | // references or we get ambiguities from msvc: |
53 | // |
54 | #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES |
55 | template <typename T> |
56 | struct remove_volatile_impl<T&&> |
57 | { |
58 | typedef T&& type; |
59 | }; |
60 | #endif |
61 | } // namespace detail |
62 | |
63 | // * convert a type T to a non-volatile type - remove_volatile<T> |
64 | |
65 | BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl<T>::type) |
66 | BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_volatile,T&,T&) |
67 | #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) |
68 | BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T volatile[N],T type[N]) |
69 | BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T const volatile[N],T const type[N]) |
70 | #endif |
71 | |
72 | |
73 | } // namespace boost |
74 | |
75 | #include <boost/type_traits/detail/type_trait_undef.hpp> |
76 | |
77 | #endif // BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED |
78 | |