mirror of
https://github.com/boostorg/move.git
synced 2025-08-02 05:44:25 +02:00
Reduced unused classes from meta_utiles and simplified the implementation of several traits classes to avoid inheritance from integral_constant
Moved declval to utility_core.hpp
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
: public ::boost::move_detail::if_c
|
||||
< ::boost::move_detail::is_class_or_union<T>::value
|
||||
, T
|
||||
, ::boost::move_detail::empty
|
||||
, ::boost::move_detail::nat
|
||||
>::type
|
||||
{
|
||||
rv();
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// move_detail::is_rv
|
||||
// is_rv
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -87,17 +87,7 @@
|
||||
|
||||
template <class T>
|
||||
struct is_rv
|
||||
: ::boost::move_detail::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct is_rv< rv<T> >
|
||||
: ::boost::move_detail::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct is_rv< const rv<T> >
|
||||
: ::boost::move_detail::integral_constant<bool, true>
|
||||
: ::boost::move_detail::is_rv_impl<T>
|
||||
{};
|
||||
|
||||
} //namespace move_detail {
|
||||
@@ -109,17 +99,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template<class T>
|
||||
struct has_move_emulation_enabled
|
||||
: ::boost::move_detail::is_convertible< T, ::boost::rv<T>& >
|
||||
{};
|
||||
|
||||
template<class T>
|
||||
struct has_move_emulation_enabled<T&>
|
||||
: ::boost::move_detail::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template<class T>
|
||||
struct has_move_emulation_enabled< ::boost::rv<T> >
|
||||
: ::boost::move_detail::integral_constant<bool, false>
|
||||
: ::boost::move_detail::has_move_emulation_enabled_impl<T>
|
||||
{};
|
||||
|
||||
} //namespace boost {
|
||||
|
@@ -92,7 +92,7 @@ typedef int bool_conversion::* explicit_bool_arg;
|
||||
namespace movelib {
|
||||
|
||||
namespace bmupd = boost::move_upd;
|
||||
namespace bmupmu = boost::move_detail;
|
||||
namespace bmupmu = ::boost::move_upmu;
|
||||
|
||||
//!The class template <tt>default_delete</tt> serves as the default deleter
|
||||
//!(destruction policy) for the class template <tt>unique_ptr</tt>.
|
||||
|
@@ -21,18 +21,11 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
//Forward declare boost::rv
|
||||
template <class T> class rv;
|
||||
#endif
|
||||
|
||||
namespace move_detail {
|
||||
|
||||
//////////////////////////////////////
|
||||
// empty
|
||||
//////////////////////////////////////
|
||||
struct empty{};
|
||||
|
||||
//////////////////////////////////////
|
||||
// nat
|
||||
//////////////////////////////////////
|
||||
@@ -115,22 +108,6 @@ struct identity
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// and_
|
||||
//////////////////////////////////////
|
||||
template <typename Condition1, typename Condition2, typename Condition3 = integral_constant<bool, true> >
|
||||
struct and_
|
||||
: public integral_constant<bool, Condition1::value && Condition2::value && Condition3::value>
|
||||
{};
|
||||
|
||||
//////////////////////////////////////
|
||||
// not_
|
||||
//////////////////////////////////////
|
||||
template <typename Boolean>
|
||||
struct not_
|
||||
: public integral_constant<bool, !Boolean::value>
|
||||
{};
|
||||
|
||||
//////////////////////////////////////
|
||||
// remove_reference
|
||||
//////////////////////////////////////
|
||||
@@ -177,47 +154,6 @@ struct remove_reference< const rv<T> &>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// remove_const
|
||||
//////////////////////////////////////
|
||||
template< class T >
|
||||
struct remove_const
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct remove_const<const T>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// remove_volatile
|
||||
//////////////////////////////////////
|
||||
template< class T >
|
||||
struct remove_volatile
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct remove_volatile<volatile T>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// remove_cv
|
||||
//////////////////////////////////////
|
||||
template< class T >
|
||||
struct remove_cv
|
||||
{
|
||||
typedef typename remove_volatile
|
||||
<typename remove_const<T>::type>::type type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// add_const
|
||||
//////////////////////////////////////
|
||||
@@ -243,71 +179,6 @@ struct add_const<T&&>
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// remove_extent
|
||||
//////////////////////////////////////
|
||||
template<class T>
|
||||
struct remove_extent
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_extent<T[]>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T, std::size_t N>
|
||||
struct remove_extent<T[N]>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// extent
|
||||
//////////////////////////////////////
|
||||
|
||||
template<class T, unsigned N = 0>
|
||||
struct extent
|
||||
{
|
||||
static const std::size_t value = 0;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct extent<T[], 0>
|
||||
{
|
||||
static const std::size_t value = 0;
|
||||
};
|
||||
|
||||
template<class T, unsigned N>
|
||||
struct extent<T[], N>
|
||||
{
|
||||
static const std::size_t value = extent<T, N-1>::value;
|
||||
};
|
||||
|
||||
template<class T, std::size_t N>
|
||||
struct extent<T[N], 0>
|
||||
{
|
||||
static const std::size_t value = N;
|
||||
};
|
||||
|
||||
template<class T, std::size_t I, unsigned N>
|
||||
struct extent<T[I], N>
|
||||
{
|
||||
static const std::size_t value = extent<T, N-1>::value;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// element_pointer
|
||||
//////////////////////////////////////
|
||||
template<class T>
|
||||
struct element_pointer
|
||||
{
|
||||
typedef typename remove_extent<T>::type element_type;
|
||||
typedef element_type* type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// add_lvalue_reference
|
||||
//////////////////////////////////////
|
||||
@@ -372,46 +243,6 @@ struct is_same<T, T>
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_pointer
|
||||
//////////////////////////////////////
|
||||
template< class T >
|
||||
struct is_pointer
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct is_pointer<T*>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_reference
|
||||
//////////////////////////////////////
|
||||
template< class T >
|
||||
struct is_reference
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct is_reference<T&>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
template< class T >
|
||||
struct is_reference<T&&>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_lvalue_reference
|
||||
//////////////////////////////////////
|
||||
@@ -427,27 +258,6 @@ struct is_lvalue_reference<T&>
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_array
|
||||
//////////////////////////////////////
|
||||
template<class T>
|
||||
struct is_array
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_array<T[]>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template<class T, std::size_t N>
|
||||
struct is_array<T[N]>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_class_or_union
|
||||
//////////////////////////////////////
|
||||
@@ -508,28 +318,6 @@ struct has_pointer_type
|
||||
static const bool value = sizeof(test<T>(0)) == 1;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// pointer_type
|
||||
//////////////////////////////////////
|
||||
template <class T, class D, bool = has_pointer_type<D>::value>
|
||||
struct pointer_type_imp
|
||||
{
|
||||
typedef typename D::pointer type;
|
||||
};
|
||||
|
||||
template <class T, class D>
|
||||
struct pointer_type_imp<T, D, false>
|
||||
{
|
||||
typedef typename remove_extent<T>::type* type;
|
||||
};
|
||||
|
||||
template <class T, class D>
|
||||
struct pointer_type
|
||||
{
|
||||
typedef typename pointer_type_imp
|
||||
<typename remove_extent<T>::type, typename remove_reference<D>::type>::type type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_convertible
|
||||
//////////////////////////////////////
|
||||
@@ -560,100 +348,125 @@ class is_convertible
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_unary_function
|
||||
//////////////////////////////////////
|
||||
#if defined(BOOST_MSVC) || defined(__BORLANDC_)
|
||||
#define BOOST_MOVE_TT_DECL __cdecl
|
||||
#else
|
||||
#define BOOST_MOVE_TT_DECL
|
||||
#endif
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// has_move_emulation_enabled_impl
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template<class T>
|
||||
struct has_move_emulation_enabled_impl
|
||||
: is_convertible< T, ::boost::rv<T>& >
|
||||
{};
|
||||
|
||||
#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(UNDER_CE)
|
||||
#define BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
||||
#endif
|
||||
template<class T>
|
||||
struct has_move_emulation_enabled_impl<T&>
|
||||
{ static const bool value = false; };
|
||||
|
||||
template <typename T>
|
||||
struct is_unary_function_impl
|
||||
{ static const bool value = false; };
|
||||
template<class T>
|
||||
struct has_move_emulation_enabled_impl< ::boost::rv<T> >
|
||||
{ static const bool value = false; };
|
||||
|
||||
// avoid duplicate definitions of is_unary_function_impl
|
||||
#ifndef BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// is_rv_impl
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_function_impl<R (*)()>
|
||||
template <class T>
|
||||
struct is_rv_impl
|
||||
{ static const bool value = false; };
|
||||
|
||||
template <class T>
|
||||
struct is_rv_impl< rv<T> >
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_function_impl<R (*)(...)>
|
||||
template <class T>
|
||||
struct is_rv_impl< const rv<T> >
|
||||
{ static const bool value = true; };
|
||||
|
||||
#else // BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
||||
// Code from Jeffrey Lee Hellrung, many thanks
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_function_impl<R (__stdcall*)()>
|
||||
template< class T >
|
||||
struct is_rvalue_reference
|
||||
{ static const bool value = false; };
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
template< class T >
|
||||
struct is_rvalue_reference< T&& >
|
||||
{ static const bool value = true; };
|
||||
|
||||
#ifndef _MANAGED
|
||||
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_function_impl<R (__fastcall*)()>
|
||||
template< class T >
|
||||
struct is_rvalue_reference< boost::rv<T>& >
|
||||
{ static const bool value = true; };
|
||||
|
||||
#endif
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_function_impl<R (__cdecl*)()>
|
||||
template< class T >
|
||||
struct is_rvalue_reference< const boost::rv<T>& >
|
||||
{ static const bool value = true; };
|
||||
|
||||
template <typename R>
|
||||
struct is_unary_function_impl<R (__cdecl*)(...)>
|
||||
{ static const bool value = true; };
|
||||
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
// avoid duplicate definitions of is_unary_function_impl
|
||||
#ifndef BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
||||
template< class T >
|
||||
struct add_rvalue_reference
|
||||
{ typedef T&& type; };
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_function_impl<R (*)(T0)>
|
||||
{ static const bool value = true; };
|
||||
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_function_impl<R (*)(T0...)>
|
||||
{ static const bool value = true; };
|
||||
namespace detail_add_rvalue_reference
|
||||
{
|
||||
template< class T
|
||||
, bool emulation = has_move_emulation_enabled_impl<T>::value
|
||||
, bool rv = is_rv_impl<T>::value >
|
||||
struct add_rvalue_reference_impl { typedef T type; };
|
||||
|
||||
#else // BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
|
||||
template< class T, bool emulation>
|
||||
struct add_rvalue_reference_impl< T, emulation, true > { typedef T & type; };
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_function_impl<R (__stdcall*)(T0)>
|
||||
{ static const bool value = true; };
|
||||
template< class T, bool rv >
|
||||
struct add_rvalue_reference_impl< T, true, rv > { typedef ::boost::rv<T>& type; };
|
||||
} // namespace detail_add_rvalue_reference
|
||||
|
||||
#ifndef _MANAGED
|
||||
template< class T >
|
||||
struct add_rvalue_reference
|
||||
: detail_add_rvalue_reference::add_rvalue_reference_impl<T>
|
||||
{ };
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_function_impl<R (__fastcall*)(T0)>
|
||||
{ static const bool value = true; };
|
||||
template< class T >
|
||||
struct add_rvalue_reference<T &>
|
||||
{ typedef T & type; };
|
||||
|
||||
#endif
|
||||
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_function_impl<R (__cdecl*)(T0)>
|
||||
{ static const bool value = true; };
|
||||
template< class T > struct remove_rvalue_reference { typedef T type; };
|
||||
|
||||
template <typename R, class T0>
|
||||
struct is_unary_function_impl<R (__cdecl*)(T0...)>
|
||||
{ static const bool value = true; };
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template< class T > struct remove_rvalue_reference< T&& > { typedef T type; };
|
||||
#else // #ifndef BOOST_NO_CXX11_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_CXX11_RVALUE_REFERENCES
|
||||
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
struct is_unary_function_impl<T&>
|
||||
{ static const bool value = false; };
|
||||
|
||||
template<typename T>
|
||||
struct is_unary_function
|
||||
{ static const bool value = is_unary_function_impl<T>::value; };
|
||||
// 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 move_detail {
|
||||
} //namespace boost {
|
||||
|
@@ -142,14 +142,14 @@ namespace move_detail {
|
||||
|
||||
template <class I>
|
||||
struct is_move_iterator
|
||||
: public ::boost::move_detail::integral_constant<bool, false>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class I>
|
||||
struct is_move_iterator< ::boost::move_iterator<I> >
|
||||
: public ::boost::move_detail::integral_constant<bool, true>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} //namespace move_detail {
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <cstddef> //for std::size_t
|
||||
#include <boost/move/detail/meta_utils.hpp>
|
||||
#include <boost/move/detail/unique_ptr_meta_utils.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#include <boost/preprocessor/iteration/local.hpp>
|
||||
@@ -36,7 +36,7 @@ namespace boost{
|
||||
|
||||
#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
|
||||
|
||||
namespace move_detail {
|
||||
namespace move_upmu {
|
||||
|
||||
//Compile time switch between
|
||||
//single element, unknown bound array
|
||||
@@ -59,7 +59,7 @@ struct unique_ptr_if<T[N]>
|
||||
typedef void t_is_array_of_known_bound;
|
||||
};
|
||||
|
||||
} //namespace move_detail {
|
||||
} //namespace move_upmu {
|
||||
|
||||
#endif //!defined(BOOST_MOVE_DOXYGEN_INVOKED)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace movelib {
|
||||
//! <b>Returns</b>: <tt>unique_ptr<T>(new T(std::forward<Args>(args)...))</tt>.
|
||||
template<class T, class... Args>
|
||||
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||
typename ::boost::move_detail::unique_ptr_if<T>::t_is_not_array)
|
||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array)
|
||||
make_unique(BOOST_FWD_REF(Args)... args)
|
||||
{ return unique_ptr<T>(new T(::boost::forward<Args>(args)...)); }
|
||||
|
||||
@@ -95,7 +95,7 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||
|
||||
#define BOOST_PP_LOCAL_MACRO(n) \
|
||||
template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
|
||||
typename ::boost::move_detail::unique_ptr_if<T>::t_is_not_array \
|
||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array \
|
||||
make_unique(BOOST_PP_ENUM(n, BOOST_MOVE_PP_PARAM_LIST, _)) \
|
||||
{ return unique_ptr<T>(new T(BOOST_PP_ENUM(n, BOOST_MOVE_PP_PARAM_FORWARD, _))); } \
|
||||
//!
|
||||
@@ -110,7 +110,7 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||
//! <b>Returns</b>: <tt>unique_ptr<T>(new T)</tt> (default initialization)
|
||||
template<class T>
|
||||
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||
typename ::boost::move_detail::unique_ptr_if<T>::t_is_not_array)
|
||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array)
|
||||
make_unique_definit()
|
||||
{
|
||||
return unique_ptr<T>(new T);
|
||||
@@ -122,10 +122,10 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||
//! <b>Returns</b>: <tt>unique_ptr<T>(new remove_extent_t<T>[n]())</tt> (value initialization)
|
||||
template<class T>
|
||||
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||
typename ::boost::move_detail::unique_ptr_if<T>::t_is_array_of_unknown_bound)
|
||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_unknown_bound)
|
||||
make_unique(std::size_t n)
|
||||
{
|
||||
typedef typename ::boost::move_detail::remove_extent<T>::type U;
|
||||
typedef typename ::boost::move_upmu::remove_extent<T>::type U;
|
||||
return unique_ptr<T>(new U[n]());
|
||||
}
|
||||
|
||||
@@ -135,10 +135,10 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||
//! <b>Returns</b>: <tt>unique_ptr<T>(new remove_extent_t<T>[n])</tt> (default initialization)
|
||||
template<class T>
|
||||
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||
typename ::boost::move_detail::unique_ptr_if<T>::t_is_array_of_unknown_bound)
|
||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_unknown_bound)
|
||||
make_unique_definit(std::size_t n)
|
||||
{
|
||||
typedef typename ::boost::move_detail::remove_extent<T>::type U;
|
||||
typedef typename ::boost::move_upmu::remove_extent<T>::type U;
|
||||
return unique_ptr<T>(new U[n]);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||
//! an array of known bound.
|
||||
template<class T, class... Args>
|
||||
inline BOOST_MOVE_DOC1ST(unspecified,
|
||||
typename ::boost::move_detail::unique_ptr_if<T>::t_is_array_of_known_bound)
|
||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_known_bound)
|
||||
make_unique(BOOST_FWD_REF(Args) ...) = delete;
|
||||
#endif
|
||||
|
||||
|
@@ -47,103 +47,24 @@ struct has_trivial_destructor_after_move
|
||||
//! and assignment can specialize this trait to obtain some performance improvements.
|
||||
template <class T>
|
||||
struct has_nothrow_move
|
||||
: public ::boost::move_detail::integral_constant
|
||||
< bool
|
||||
, boost::is_nothrow_move_constructible<T>::value &&
|
||||
boost::is_nothrow_move_assignable<T>::value
|
||||
>
|
||||
{};
|
||||
{
|
||||
static const bool value = boost::is_nothrow_move_constructible<T>::value &&
|
||||
boost::is_nothrow_move_assignable<T>::value;
|
||||
};
|
||||
|
||||
namespace move_detail {
|
||||
|
||||
template <class T>
|
||||
struct is_nothrow_move_constructible_or_uncopyable
|
||||
: public ::boost::move_detail::integral_constant
|
||||
< bool
|
||||
//The standard requires is_nothrow_move_constructible for move_if_noexcept
|
||||
//but a user (usually in C++03) might specialize has_nothrow_move which includes it
|
||||
, boost::is_nothrow_move_constructible<T>::value ||
|
||||
has_nothrow_move<T>::value ||
|
||||
!boost::is_copy_constructible<T>::value
|
||||
>
|
||||
{};
|
||||
|
||||
// Code from Jeffrey Lee Hellrung, many thanks
|
||||
|
||||
template< class T > struct is_rvalue_reference : ::boost::move_detail::integral_constant<bool, false> { };
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template< class T > struct is_rvalue_reference< T&& > : ::boost::move_detail::integral_constant<bool, true> { };
|
||||
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template< class T > struct is_rvalue_reference< boost::rv<T>& >
|
||||
: ::boost::move_detail::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template< class T > struct is_rvalue_reference< const boost::rv<T>& >
|
||||
: ::boost::move_detail::integral_constant<bool, true>
|
||||
{};
|
||||
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template< class T > struct add_rvalue_reference { typedef T&& type; };
|
||||
#else // #ifndef BOOST_NO_CXX11_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_CXX11_RVALUE_REFERENCES
|
||||
|
||||
template< class T > struct remove_rvalue_reference { typedef T type; };
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template< class T > struct remove_rvalue_reference< T&& > { typedef T type; };
|
||||
#else // #ifndef BOOST_NO_CXX11_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_CXX11_RVALUE_REFERENCES
|
||||
|
||||
template <typename T>
|
||||
typename boost::move_detail::add_rvalue_reference<T>::type declval();
|
||||
{
|
||||
//The standard requires is_nothrow_move_constructible for move_if_noexcept
|
||||
//but a user (usually in C++03) might specialize has_nothrow_move which includes it
|
||||
static const bool value = boost::is_nothrow_move_constructible<T>::value ||
|
||||
has_nothrow_move<T>::value ||
|
||||
!boost::is_copy_constructible<T>::value;
|
||||
};
|
||||
|
||||
} //move_detail {
|
||||
|
||||
// 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 {
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@@ -723,7 +723,7 @@ class unique_ptr
|
||||
//! <b>Effects</b>: Invokes swap on the stored pointers and on the stored deleters of *this and u.
|
||||
void swap(unique_ptr& u) BOOST_NOEXCEPT
|
||||
{
|
||||
using bmupmu::swap;
|
||||
using ::boost::move_detail::swap;
|
||||
swap(m_data.m_p, u.m_data.m_p);
|
||||
swap(m_data.deleter(), u.m_data.deleter());
|
||||
}
|
||||
|
@@ -112,20 +112,21 @@
|
||||
//! constructible or if it has no copy constructor. In all other cases const
|
||||
//! reference would be returned
|
||||
template <class T>
|
||||
rvalue_reference move_if_noexcept(input_reference) noexcept;
|
||||
rvalue_reference_or_const_lvalue_reference move_if_noexcept(input_reference) noexcept;
|
||||
|
||||
#else //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
|
||||
#else //BOOST_MOVE_DOXYGEN_INVOKED
|
||||
|
||||
template <class T>
|
||||
inline typename ::boost::move_detail::if_c
|
||||
< ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value
|
||||
, T&&
|
||||
, const T&
|
||||
>::type
|
||||
typename ::boost::move_detail::enable_if_c
|
||||
< ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, T&&>::type
|
||||
move_if_noexcept(T& x) BOOST_NOEXCEPT
|
||||
{
|
||||
return ::boost::move(x);
|
||||
}
|
||||
{ return ::boost::move(x); }
|
||||
|
||||
template <class T>
|
||||
typename ::boost::move_detail::enable_if_c
|
||||
< !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, const T&>::type
|
||||
move_if_noexcept(T& x) BOOST_NOEXCEPT
|
||||
{ return x; }
|
||||
|
||||
#endif //BOOST_MOVE_DOXYGEN_INVOKED
|
||||
|
||||
|
@@ -281,6 +281,9 @@ void swap(T &a, T &b)
|
||||
b = ::boost::move(c);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename boost::move_detail::add_rvalue_reference<T>::type declval();
|
||||
|
||||
} //namespace move_detail{
|
||||
} //namespace boost{
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#ifndef BOOST_MOVE_UNIQUE_PTR_TEST_UTILS_BEG_HPP
|
||||
#define BOOST_MOVE_UNIQUE_PTR_TEST_UTILS_BEG_HPP
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/detail/meta_utils.hpp>
|
||||
#include <boost/move/detail/unique_ptr_meta_utils.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
@@ -39,8 +39,8 @@ class def_constr_deleter
|
||||
def_constr_deleter& operator=(const def_constr_deleter&);
|
||||
|
||||
public:
|
||||
typedef typename ::boost::move_detail::remove_extent<T>::type element_type;
|
||||
static const bool is_array = ::boost::move_detail::is_array<T>::value;
|
||||
typedef typename ::boost::move_upmu::remove_extent<T>::type element_type;
|
||||
static const bool is_array = ::boost::move_upmu::is_array<T>::value;
|
||||
|
||||
def_constr_deleter() : state_(5) {}
|
||||
|
||||
@@ -64,8 +64,8 @@ class copy_constr_deleter
|
||||
int state_;
|
||||
|
||||
public:
|
||||
typedef typename ::boost::move_detail::remove_extent<T>::type element_type;
|
||||
static const bool is_array = ::boost::move_detail::is_array<T>::value;
|
||||
typedef typename ::boost::move_upmu::remove_extent<T>::type element_type;
|
||||
static const bool is_array = ::boost::move_upmu::is_array<T>::value;
|
||||
|
||||
copy_constr_deleter() : state_(5) {}
|
||||
|
||||
@@ -104,8 +104,8 @@ class move_constr_deleter
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(move_constr_deleter)
|
||||
|
||||
public:
|
||||
typedef typename ::boost::move_detail::remove_extent<T>::type element_type;
|
||||
static const bool is_array = ::boost::move_detail::is_array<T>::value;
|
||||
typedef typename ::boost::move_upmu::remove_extent<T>::type element_type;
|
||||
static const bool is_array = ::boost::move_upmu::is_array<T>::value;
|
||||
|
||||
move_constr_deleter() : state_(5) {}
|
||||
|
||||
@@ -182,7 +182,7 @@ int B::count = 0;
|
||||
|
||||
void reset_counters();
|
||||
|
||||
BOOST_STATIC_ASSERT((::boost::move_detail::is_convertible<B, A>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::move_upmu::is_convertible<B, A>::value));
|
||||
|
||||
//Incomplete Type function declarations
|
||||
struct I;
|
||||
|
Reference in New Issue
Block a user