mirror of
https://github.com/boostorg/move.git
synced 2025-07-31 21:04:27 +02:00
Introducing allocator_traits and pointer_traits changes into several libraries.
[SVN r76106]
This commit is contained in:
@@ -23,9 +23,12 @@
|
|||||||
|
|
||||||
#ifdef BOOST_MSVC
|
#ifdef BOOST_MSVC
|
||||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||||
#define BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
|
#define BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
|
||||||
#define _CRT_SECURE_NO_DEPRECATE
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
#define _SCL_SECURE_NO_WARNINGS
|
#endif
|
||||||
|
#ifndef _SCL_SECURE_NO_WARNINGS
|
||||||
|
#define BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS
|
||||||
|
#define _SCL_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
#pragma warning (push)
|
#pragma warning (push)
|
||||||
#pragma warning(disable:4996)
|
#pragma warning(disable:4996)
|
||||||
@@ -1080,14 +1083,112 @@ struct has_trivial_destructor_after_move
|
|||||||
: BOOST_MOVE_BOOST_NS::has_trivial_destructor<T>
|
: BOOST_MOVE_BOOST_NS::has_trivial_destructor<T>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace move_detail {
|
||||||
|
|
||||||
|
// Code from Jeffrey Lee Hellrung, many thanks
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
template< class T> struct forward_type { typedef T type; };
|
||||||
|
#else // #ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
template< class T>
|
||||||
|
struct forward_type
|
||||||
|
{ typedef const T &type; };
|
||||||
|
|
||||||
|
template< class T>
|
||||||
|
struct forward_type< boost::rv<T> >
|
||||||
|
{ typedef T type; };
|
||||||
|
#endif // #ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Code from Jeffrey Lee Hellrung, many thanks
|
||||||
|
|
||||||
|
template< class T > struct is_rvalue_reference : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> { };
|
||||||
|
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
template< class T > struct is_rvalue_reference< T&& > : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> { };
|
||||||
|
#else // #ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
template< class T > struct is_rvalue_reference< boost::rv<T>& >
|
||||||
|
: BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
|
||||||
|
{};
|
||||||
|
|
||||||
|
template< class T > struct is_rvalue_reference< const boost::rv<T>& >
|
||||||
|
: BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
|
||||||
|
{};
|
||||||
|
#endif // #ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
template< class T > struct add_rvalue_reference { typedef T&& type; };
|
||||||
|
#else // #ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
namespace detail_add_rvalue_reference
|
||||||
|
{
|
||||||
|
template< class T
|
||||||
|
, bool emulation = ::boost::has_move_emulation_enabled<T>::value
|
||||||
|
, bool rv = ::boost::move_detail::is_rv<T>::value >
|
||||||
|
struct add_rvalue_reference_impl { typedef T type; };
|
||||||
|
|
||||||
|
template< class T, bool emulation>
|
||||||
|
struct add_rvalue_reference_impl< T, emulation, true > { typedef T & type; };
|
||||||
|
|
||||||
|
template< class T, bool rv >
|
||||||
|
struct add_rvalue_reference_impl< T, true, rv > { typedef ::boost::rv<T>& type; };
|
||||||
|
} // namespace detail_add_rvalue_reference
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
struct add_rvalue_reference
|
||||||
|
: detail_add_rvalue_reference::add_rvalue_reference_impl<T>
|
||||||
|
{ };
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
struct add_rvalue_reference<T &>
|
||||||
|
{ typedef T & type; };
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
|
template< class T > struct remove_rvalue_reference { typedef T type; };
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
template< class T > struct remove_rvalue_reference< T&& > { typedef T type; };
|
||||||
|
#else // #ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
template< class T > struct remove_rvalue_reference< rv<T> > { typedef T type; };
|
||||||
|
template< class T > struct remove_rvalue_reference< const rv<T> > { typedef T type; };
|
||||||
|
template< class T > struct remove_rvalue_reference< volatile rv<T> > { typedef T type; };
|
||||||
|
template< class T > struct remove_rvalue_reference< const volatile rv<T> > { typedef T type; };
|
||||||
|
template< class T > struct remove_rvalue_reference< rv<T>& > { typedef T type; };
|
||||||
|
template< class T > struct remove_rvalue_reference< const rv<T>& > { typedef T type; };
|
||||||
|
template< class T > struct remove_rvalue_reference< volatile rv<T>& > { typedef T type; };
|
||||||
|
template< class T > struct remove_rvalue_reference< const volatile rv<T>& >{ typedef T type; };
|
||||||
|
#endif // #ifndef BOOST_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
typename boost::move_detail::add_rvalue_reference<T>::type declval();
|
||||||
|
|
||||||
|
}
|
||||||
|
// Ideas from Boost.Move review, Jeffrey Lee Hellrung:
|
||||||
|
//
|
||||||
|
//- TypeTraits metafunctions is_lvalue_reference, add_lvalue_reference, and remove_lvalue_reference ?
|
||||||
|
// Perhaps add_reference and remove_reference can be modified so that they behave wrt emulated rvalue
|
||||||
|
// references the same as wrt real rvalue references, i.e., add_reference< rv<T>& > -> T& rather than
|
||||||
|
// rv<T>& (since T&& & -> T&).
|
||||||
|
//
|
||||||
|
//- Add'l TypeTraits has_[trivial_]move_{constructor,assign}...?
|
||||||
|
//
|
||||||
|
//- An as_lvalue(T& x) function, which amounts to an identity operation in C++0x, but strips emulated
|
||||||
|
// rvalue references in C++03. This may be necessary to prevent "accidental moves".
|
||||||
|
|
||||||
} //namespace boost {
|
} //namespace boost {
|
||||||
|
|
||||||
#if defined BOOST_MSVC
|
#if defined BOOST_MSVC
|
||||||
#pragma warning (pop)
|
#pragma warning (pop)
|
||||||
#ifdef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
|
#ifdef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
|
||||||
#undef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
|
#undef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE
|
||||||
#undef _CRT_SECURE_NO_DEPRECATE
|
#undef _CRT_SECURE_NO_DEPRECATE
|
||||||
#undef _SCL_SECURE_NO_WARNINGS
|
#endif
|
||||||
|
|
||||||
|
#ifdef BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS
|
||||||
|
#undef BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS
|
||||||
|
#undef _SCL_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user