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__) && !defined(__COMO__)
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)
46
#if defined(__GNUC__) && (__GNUC__ < 3)
47
// these allow us to work around illegally cv-qualified reference
49
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T const ,::boost::is_reference<T>::value)
50
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T volatile ,::boost::is_reference<T>::value)
51
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T const volatile ,::boost::is_reference<T>::value)
52
// However, the above specializations confuse gcc 2.96 unless we also
53
// supply these specializations for array types
54
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference,T[N],false)
55
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference,const T[N],false)
56
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference,volatile T[N],false)
57
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference,const volatile T[N],false)
63
# pragma warning(push)
64
# pragma warning(disable: 4181)
69
using ::boost::type_traits::yes_type;
70
using ::boost::type_traits::no_type;
71
using ::boost::type_traits::wrap;
73
template <class T> T&(* is_reference_helper1(wrap<T>) )(wrap<T>);
74
char is_reference_helper1(...);
76
template <class T> no_type is_reference_helper2(T&(*)(wrap<T>));
77
yes_type is_reference_helper2(...);
80
struct is_reference_impl
82
BOOST_STATIC_CONSTANT(
84
::boost::detail::is_reference_helper2(
85
::boost::detail::is_reference_helper1(::boost::type_traits::wrap<T>()))) == 1
89
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void,false)
90
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
91
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void const,false)
92
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void volatile,false)
93
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void const volatile,false)
98
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,::boost::detail::is_reference_impl<T>::value)
101
# pragma warning(pop)
104
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
108
#include "boost/type_traits/detail/bool_trait_undef.hpp"
110
#endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED