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_CONST_HPP_INCLUDED
22#define BOOST_TT_IS_CONST_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# ifdef __GNUC__
29# include <boost/type_traits/is_reference.hpp>
30# endif
31# if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
32# include <boost/type_traits/remove_bounds.hpp>
33# endif
34
35// should be the last #include
36#include <boost/type_traits/detail/bool_trait_def.hpp>
37
38namespace boost {
39
40#if defined( __CODEGEARC__ )
41
42BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,__is_const(T))
43
44#else
45
46namespace detail{
47//
48// We can't filter out rvalue_references at the same level as
49// references or we get ambiguities from msvc:
50//
51template <class T>
52struct is_const_rvalue_filter
53{
54#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
55 BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<typename boost::remove_bounds<T>::type*>::is_const);
56#else
57 BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::is_const);
58#endif
59};
60#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
61template <class T>
62struct is_const_rvalue_filter<T&&>
63{
64 BOOST_STATIC_CONSTANT(bool, value = false);
65};
66#endif
67}
68
69//* is a type T declared const - is_const<T>
70BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::is_const_rvalue_filter<T>::value)
71BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T&,false)
72
73#if defined(BOOST_ILLEGAL_CV_REFERENCES)
74// these are illegal specialisations; cv-qualifies applied to
75// references have no effect according to [8.3.2p1],
76// C++ Builder requires them though as it treats cv-qualified
77// references as distinct types...
78BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T& const,false)
79BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T& volatile,false)
80BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T& const volatile,false)
81#endif
82
83#endif
84
85} // namespace boost
86
87#include <boost/type_traits/detail/bool_trait_undef.hpp>
88
89#endif // BOOST_TT_IS_CONST_HPP_INCLUDED
90
91