1
0
forked from boostorg/core

merge RC_1_32_0 fixes

[SVN r26333]
This commit is contained in:
Aleksey Gurtovoy
2004-11-28 04:44:21 +00:00
committed by Peter Dimov
parent a8c403d864
commit 65f05c3d41
2 changed files with 16 additions and 2 deletions

View File

@@ -128,7 +128,7 @@ When valid, <TT>enable_if_c&lt;B, T&gt;::type</TT> equals <TT>T</TT>.
The <TT>enable_if_c</TT> template can thus be used for controlling when functions are considered for The <TT>enable_if_c</TT> template can thus be used for controlling when functions are considered for
overload resolution and when they are not. overload resolution and when they are not.
For example, the following function is defined for all arithmetic types (according to the For example, the following function is defined for all arithmetic types (according to the
classification of the <A HREF="http://www.boost.org/libs/type_traits">Boost type_traits library</A>): classification of the <A HREF="../type_traits/index.html">Boost type_traits library</A>):
<PRE>template &lt;class T&gt; <PRE>template &lt;class T&gt;
typename enable_if_c&lt;boost::is_arithmetic&lt;T&gt;::value, T&gt;::type typename enable_if_c&lt;boost::is_arithmetic&lt;T&gt;::value, T&gt;::type
foo(T t) { return t; } foo(T t) { return t; }

View File

@@ -7,8 +7,12 @@
// see 'ref_test.cpp' for run-time part // see 'ref_test.cpp' for run-time part
#include <boost/ref.hpp> #include <boost/ref.hpp>
#include <boost/type_traits/same_traits.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/mpl/assert.hpp>
namespace { namespace {
@@ -35,13 +39,23 @@ void is_reference_wrapper_test(T)
template< typename R, typename Ref > template< typename R, typename Ref >
void cxx_reference_test(Ref) void cxx_reference_test(Ref)
{ {
#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
typedef typename boost::remove_const<Ref>::type ref;
BOOST_STATIC_ASSERT((boost::is_same<R,ref>::value));
#else
BOOST_STATIC_ASSERT((boost::is_same<R,Ref>::value)); BOOST_STATIC_ASSERT((boost::is_same<R,Ref>::value));
#endif
} }
template< typename R, typename Ref > template< typename R, typename Ref >
void unwrap_reference_test(Ref) void unwrap_reference_test(Ref)
{ {
#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
typedef typename boost::remove_const<Ref>::type ref;
typedef typename boost::unwrap_reference<ref>::type type;
#else
typedef typename boost::unwrap_reference<Ref>::type type; typedef typename boost::unwrap_reference<Ref>::type type;
#endif
BOOST_STATIC_ASSERT((boost::is_same<R,type>::value)); BOOST_STATIC_ASSERT((boost::is_same<R,type>::value));
} }