2 // (C) Copyright David Abrahams Steve Cleary, Beman Dawes, Howard
3 // Hinnant & John Maddock 2000-2002. Permission to copy, use,
4 // modify, sell and distribute this software is granted provided this
5 // copyright notice appears in all copies. This software is provided
6 // "as is" without express or implied warranty, and with no claim as
7 // to its suitability for any purpose.
9 // See http://www.boost.org for most recent version including documentation.
11 #ifndef BOOST_TT_IS_REFERENCE_HPP_INCLUDED
12 #define BOOST_TT_IS_REFERENCE_HPP_INCLUDED
14 #include "boost/type_traits/config.hpp"
16 #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
17 # include "boost/type_traits/detail/yes_no_type.hpp"
18 # include "boost/type_traits/detail/wrap.hpp"
21 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && defined(BOOST_MSVC)
22 # include "boost/type_traits/detail/is_function_type_tester.hpp"
23 # include "boost/type_traits/detail/false_result.hpp"
26 // should be the last #include
27 #include "boost/type_traits/detail/bool_trait_def.hpp"
31 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
33 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,false)
34 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T&,true)
36 #if defined(__BORLANDC__)
37 // these are illegal specialisations; cv-qualifies applied to
38 // references have no effect according to [8.3.2p1],
39 // C++ Builder requires them though as it treats cv-qualified
40 // references as distinct types...
41 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T& const,true)
42 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T& volatile,true)
43 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T& const volatile,true)
49 # pragma warning(push)
50 # pragma warning(disable: 4181)
55 using ::boost::type_traits::yes_type;
56 using ::boost::type_traits::no_type;
57 using ::boost::type_traits::wrap;
59 template <class T> T&(* is_reference_helper1(wrap<T>) )(wrap<T>);
60 char is_reference_helper1(...);
62 template <class T> no_type is_reference_helper2(T&(*)(wrap<T>));
63 yes_type is_reference_helper2(...);
66 struct is_reference_impl
68 BOOST_STATIC_CONSTANT(
70 ::boost::detail::is_reference_helper2(
71 ::boost::detail::is_reference_helper1(::boost::type_traits::wrap<T>()))) == 1
77 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,::boost::detail::is_reference_impl<T>::value)
78 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void,false)
79 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
80 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void const,false)
81 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void volatile,false)
82 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void const volatile,false)
89 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
93 #include "boost/type_traits/detail/bool_trait_undef.hpp"
95 #endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED