forked from boostorg/move
* Better header segregation (bug
[@https://svn.boost.org/trac/boost/ticket/6524 #6524]). * Small documentation fixes * Replaced deprecated BOOST_NO_XXXX with newer BOOST_NO_CXX11_XXX macros. [SVN r81515]
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/container/deque.hpp>
|
||||
#include <boost/container/list.hpp>
|
||||
#include <boost/container/stable_vector.hpp>
|
||||
@@ -72,3 +73,5 @@ int main()
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
+13
-11
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright David Abrahams, Vicente Botet, Ion Gaztanaga 2009-2011.
|
||||
// (C) Copyright David Abrahams, Vicente Botet, Ion Gaztanaga 2009-2012.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -8,8 +8,8 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
#include "../example/copymovable.hpp"
|
||||
@@ -24,36 +24,36 @@ class non_movable
|
||||
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(BOOST_RV_REF(MaybeRvalue) x
|
||||
#ifdef BOOST_NO_RVALUE_REFERENCES
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
,typename ::boost::enable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
#endif //BOOST_NO_RVALUE_REFERENCES
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
)
|
||||
{ (void)x;}
|
||||
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(BOOST_COPY_ASSIGN_REF(MaybeRvalue) x
|
||||
#ifdef BOOST_NO_RVALUE_REFERENCES
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
,typename ::boost::enable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
#endif //BOOST_NO_RVALUE_REFERENCES
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
)
|
||||
|
||||
{ (void)x;}
|
||||
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(MaybeRvalue &x
|
||||
#ifdef BOOST_NO_RVALUE_REFERENCES
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
,typename ::boost::enable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
#endif //BOOST_NO_RVALUE_REFERENCES
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
)
|
||||
{ (void)x;}
|
||||
|
||||
#ifdef BOOST_NO_RVALUE_REFERENCES
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(const MaybeRvalue& x
|
||||
,typename ::boost::disable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
)
|
||||
{ (void)x;}
|
||||
#endif //BOOST_NO_RVALUE_REFERENCES
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
movable create_movable()
|
||||
{ return movable(); }
|
||||
@@ -113,3 +113,5 @@ int main()
|
||||
forward_test();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright David Abrahams, Vicente Botet, Ion Gaztanaga 2010-2011.
|
||||
// (C) Copyright David Abrahams, Vicente Botet, Ion Gaztanaga 2010-2012.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -8,12 +8,14 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
|
||||
#include <boost/type_traits/aligned_storage.hpp>
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <cassert>
|
||||
#include <boost/move/move_helpers.hpp>
|
||||
#include <new>
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
|
||||
|
||||
enum ConstructionType { Copied, Moved, Other };
|
||||
@@ -105,11 +107,11 @@ class container
|
||||
|
||||
template<class U>
|
||||
void priv_push_back(BOOST_MOVE_CATCH_FWD(U) x)
|
||||
{ new (&storage_) T(::boost::forward<U>(x)); }
|
||||
{ ::new (&storage_) T(::boost::forward<U>(x)); }
|
||||
|
||||
template<class U>
|
||||
iterator priv_insert(const_iterator, BOOST_MOVE_CATCH_FWD(U) x)
|
||||
{ new (&storage_) T(::boost::forward<U>(x)); return 0; }
|
||||
{ ::new (&storage_) T(::boost::forward<U>(x)); return 0; }
|
||||
};
|
||||
|
||||
|
||||
@@ -292,8 +294,10 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
/*
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
@@ -366,7 +370,7 @@ class conversion_target_movable
|
||||
|
||||
struct not_a_type;
|
||||
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#define BOOST_MOVE_CATCH_CONST(U) \
|
||||
typename ::boost::mpl::if_< ::boost::is_class<T>, BOOST_CATCH_CONST_RLVALUE(U), const U &>::type
|
||||
#define BOOST_MOVE_CATCH_RVALUE(U)\
|
||||
@@ -470,7 +474,7 @@ class container
|
||||
{ return priv_push_back(::boost::move(x)); }
|
||||
|
||||
//Tricks for C++03
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
void push_back(T &x)
|
||||
{ priv_push_back(const_cast<const T &>(x)); }
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef NO_MOVE
|
||||
@@ -11,7 +12,7 @@
|
||||
# define BOOST_COPYABLE_AND_MOVABLE(X)
|
||||
# define MOVE(x) (x)
|
||||
#else
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
# define MOVE(x) boost::move(x)
|
||||
#endif
|
||||
|
||||
@@ -91,17 +92,17 @@ unsigned X::instances = 0;
|
||||
struct trace
|
||||
{
|
||||
trace(char const* name)
|
||||
: name(name)
|
||||
: m_name(name)
|
||||
{
|
||||
std::cout << "->: " << name << "\n";
|
||||
std::cout << "->: " << m_name << "\n";
|
||||
}
|
||||
|
||||
~trace()
|
||||
{
|
||||
std::cout << "<-: " << name << "\n";
|
||||
std::cout << "<-: " << m_name << "\n";
|
||||
}
|
||||
|
||||
char const* name;
|
||||
char const* m_name;
|
||||
};
|
||||
|
||||
void sink(X a)
|
||||
@@ -168,3 +169,5 @@ int main(int argc, char* argv[])
|
||||
CHECK_COPIES( X a = ternary( argc != 1000 ), 0, 2, "Return result of ternary operation again" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
//Optimization:
|
||||
//Since RVO is better than move-construction,
|
||||
//avoid copy constructor overloading.
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
#include <iostream>
|
||||
|
||||
bool moved = false;
|
||||
@@ -103,3 +104,4 @@ int main()
|
||||
//1 const rv<T> & constructor: copy constructor
|
||||
//1 T & constructor: copy constructor
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
+5
-3
@@ -8,8 +8,8 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
@@ -64,7 +64,7 @@ movable create_movable()
|
||||
{ return movable(); }
|
||||
int main()
|
||||
{
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
BOOST_STATIC_ASSERT((boost::has_nothrow_move<movable>::value == true));
|
||||
BOOST_STATIC_ASSERT((boost::has_nothrow_move<copyable>::value == false));
|
||||
BOOST_STATIC_ASSERT((boost::has_move_emulation_enabled<copyable>::value == false));
|
||||
@@ -112,3 +112,5 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/algorithm.hpp>
|
||||
#include <boost/container/vector.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
|
||||
@@ -53,3 +54,5 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
+3
-52
@@ -8,8 +8,8 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/container/vector.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
|
||||
@@ -52,53 +52,4 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
#include <boost/move/move.hpp>
|
||||
|
||||
|
||||
class copy_movable
|
||||
{
|
||||
BOOST_COPYABLE_AND_MOVABLE(copy_movable)
|
||||
int value_;
|
||||
|
||||
public:
|
||||
copy_movable() : value_(1){}
|
||||
|
||||
//Move constructor and assignment
|
||||
copy_movable(BOOST_RV_REF(copy_movable) m)
|
||||
{ value_ = m.value_; m.value_ = 0; }
|
||||
|
||||
copy_movable(const copy_movable &m)
|
||||
{ value_ = m.value_; }
|
||||
|
||||
copy_movable & operator=(BOOST_RV_REF(copy_movable) m)
|
||||
{ value_ = m.value_; m.value_ = 0; return *this; }
|
||||
|
||||
copy_movable & operator=(BOOST_COPY_ASSIGN_REF(copy_movable) m)
|
||||
{ value_ = m.value_; return *this; }
|
||||
|
||||
bool moved() const //Observer
|
||||
{ return value_ == 0; }
|
||||
};
|
||||
|
||||
struct copy_movable_wrapper
|
||||
{
|
||||
copy_movable cm;
|
||||
};
|
||||
|
||||
copy_movable produce()
|
||||
{ return copy_movable(); }
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
copy_movable cm;
|
||||
cm = produce();
|
||||
|
||||
const copy_movable_wrapper cmw;
|
||||
copy_movable_wrapper cmw2;
|
||||
cmw2 = cmw;
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
Reference in New Issue
Block a user