forked from boostorg/core
merge RC_1_32_0 fixes
[SVN r26333]
This commit is contained in:
committed by
Peter Dimov
parent
a8c403d864
commit
65f05c3d41
@@ -128,7 +128,7 @@ When valid, <TT>enable_if_c<B, T>::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 <class T>
|
<PRE>template <class T>
|
||||||
typename enable_if_c<boost::is_arithmetic<T>::value, T>::type
|
typename enable_if_c<boost::is_arithmetic<T>::value, T>::type
|
||||||
foo(T t) { return t; }
|
foo(T t) { return t; }
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user