forked from boostorg/type_traits
Fix tests for is_copy_constructible triat and fix reference-to-reference issue (refs #8802).
[SVN r85060]
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/utility/declval.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
@ -65,9 +66,11 @@ struct is_copy_constructible_impl2 {
|
||||
// T(const T &) = delete;
|
||||
// ...
|
||||
// };
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value = (sizeof(test(boost::declval<T&>())) == sizeof(boost::type_traits::yes_type))
|
||||
);
|
||||
BOOST_STATIC_CONSTANT(bool, value = (
|
||||
sizeof(test(
|
||||
boost::declval<BOOST_DEDUCED_TYPENAME boost::add_reference<T>::type>()
|
||||
)) == sizeof(boost::type_traits::yes_type)
|
||||
));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
@ -81,7 +84,8 @@ struct is_copy_constructible_impl {
|
||||
BOOST_STATIC_CONSTANT(bool, value = (
|
||||
boost::detail::is_copy_constructible_impl2<
|
||||
boost::is_base_and_derived<boost::noncopyable, T>::value,
|
||||
T>::value
|
||||
T
|
||||
>::value
|
||||
));
|
||||
};
|
||||
|
||||
|
@ -259,7 +259,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<enum_UDT>::value, true
|
||||
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<int&>::value, true);
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<int&&>::value, true);
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<int&&>::value, false);
|
||||
#endif
|
||||
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_copy_constructible<const int&>::value, true);
|
||||
|
||||
|
Reference in New Issue
Block a user