1 | |
2 | // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, |
3 | // Howard Hinnant and John Maddock 2000. |
4 | // (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 2001 |
5 | |
6 | // Use, modification and distribution are subject to the Boost Software License, |
7 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
8 | // http://www.boost.org/LICENSE_1_0.txt). |
9 | // |
10 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. |
11 | |
12 | // Fixed is_pointer, is_reference, is_const, is_volatile, is_same, |
13 | // is_member_pointer based on the Simulated Partial Specialization work |
14 | // of Mat Marcus and Jesse Jones. See http://opensource.adobe.com or |
15 | // http://groups.yahoo.com/group/boost/message/5441 |
16 | // Some workarounds in here use ideas suggested from "Generic<Programming>: |
17 | // Mappings between Types and Values" |
18 | // by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html). |
19 | |
20 | |
21 | #ifndef BOOST_TT_IS_VOLATILE_HPP_INCLUDED |
22 | #define BOOST_TT_IS_VOLATILE_HPP_INCLUDED |
23 | |
24 | #include <boost/config.hpp> |
25 | #include <boost/detail/workaround.hpp> |
26 | |
27 | # include <boost/type_traits/detail/cv_traits_impl.hpp> |
28 | # if BOOST_WORKAROUND(BOOST_MSVC, < 1400) |
29 | # include <boost/type_traits/remove_bounds.hpp> |
30 | # endif |
31 | |
32 | // should be the last #include |
33 | #include <boost/type_traits/detail/bool_trait_def.hpp> |
34 | |
35 | namespace boost { |
36 | |
37 | namespace detail{ |
38 | template <class T> |
39 | struct is_volatile_rval_filter |
40 | { |
41 | #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) |
42 | BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<typename boost::remove_bounds<T>::type*>::is_volatile); |
43 | #else |
44 | BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::is_volatile); |
45 | #endif |
46 | }; |
47 | #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES |
48 | // |
49 | // We can't filter out rvalue_references at the same level as |
50 | // references or we get ambiguities from msvc: |
51 | // |
52 | template <class T> |
53 | struct is_volatile_rval_filter<T&&> |
54 | { |
55 | BOOST_STATIC_CONSTANT(bool, value = false); |
56 | }; |
57 | #endif |
58 | } |
59 | |
60 | #if defined( __CODEGEARC__ ) |
61 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,__is_volatile(T)) |
62 | #else |
63 | |
64 | //* is a type T declared volatile - is_volatile<T> |
65 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::is_volatile_rval_filter<T>::value) |
66 | BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T&,false) |
67 | |
68 | #if defined(BOOST_ILLEGAL_CV_REFERENCES) |
69 | // these are illegal specialisations; cv-qualifies applied to |
70 | // references have no effect according to [8.3.2p1], |
71 | // C++ Builder requires them though as it treats cv-qualified |
72 | // references as distinct types... |
73 | BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T& const,false) |
74 | BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T& volatile,false) |
75 | BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T& const volatile,false) |
76 | #endif |
77 | |
78 | #endif |
79 | |
80 | } // namespace boost |
81 | |
82 | #include <boost/type_traits/detail/bool_trait_undef.hpp> |
83 | |
84 | #endif // BOOST_TT_IS_VOLATILE_HPP_INCLUDED |
85 | |