mirror of
https://github.com/boostorg/move.git
synced 2025-07-31 12:57:14 +02:00
Merged from trunk
[SVN r81661]
This commit is contained in:
@ -13,7 +13,7 @@ import quickbook ;
|
||||
|
||||
doxygen autodoc
|
||||
:
|
||||
[ glob ../../../boost/move/move.hpp ]
|
||||
[ glob ../../../boost/move/*.hpp ]
|
||||
:
|
||||
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
||||
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
||||
|
15
doc/move.qbk
15
doc/move.qbk
@ -7,7 +7,7 @@
|
||||
[library Boost.Move
|
||||
[quickbook 1.5]
|
||||
[authors [Gaztanaga, Ion]]
|
||||
[copyright 2008-2010 Ion Gaztanaga]
|
||||
[copyright 2008-2012 Ion Gaztanaga]
|
||||
[id move]
|
||||
[dirname move]
|
||||
[purpose Move semantics]
|
||||
@ -318,7 +318,7 @@ This library makes this emulation easy with the help of `BOOST_FWD_REF` and
|
||||
[import ../example/doc_construct_forward.cpp]
|
||||
[construct_forward_example]
|
||||
|
||||
Constructor forwarding comes handful to implement placement insertion in containers with
|
||||
Constructor forwarding comes in handy to implement placement insertion in containers with
|
||||
just N overloads if the implementor accepts the limitations of this type of forwarding for
|
||||
C++03 compilers. In compilers with rvalue references perfect forwarding is achieved.
|
||||
|
||||
@ -778,7 +778,7 @@ presence of three overloads and the conversion operators in C++03 compilers:
|
||||
[section:thanks_to Thanks and credits]
|
||||
|
||||
Thanks to all that developed ideas for move emulation: the first emulation was based on Howard Hinnant
|
||||
emulation code for `unique_ptr`, David Abrahams suggested the use of `class rv` class,
|
||||
emulation code for `unique_ptr`, David Abrahams suggested the use of `class rv`,
|
||||
and Klaus Triendl discovered how to bind const rlvalues using `class rv`.
|
||||
|
||||
Many thanks to all boosters that have tested, reviewed and improved the library.
|
||||
@ -787,6 +787,15 @@ Many thanks to all boosters that have tested, reviewed and improved the library.
|
||||
|
||||
[section:release_notes Release Notes]
|
||||
|
||||
[section:release_notes_boost_1_53_00 Boost 1.53 Release]
|
||||
|
||||
* 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.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:release_notes_boost_1_51_00 Boost 1.51 Release]
|
||||
|
||||
* Fixed bugs
|
||||
|
@ -11,9 +11,11 @@
|
||||
#ifndef BOOST_MOVE_TEST_COPYMOVABLE_HPP
|
||||
#define BOOST_MOVE_TEST_COPYMOVABLE_HPP
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[movable_definition
|
||||
//header file "copy_movable.hpp"
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
|
||||
//A copy_movable class
|
||||
class copy_movable
|
||||
@ -43,4 +45,6 @@ class copy_movable
|
||||
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_MOVE_TEST_COPYMOVABLE_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/utility.hpp>
|
||||
|
||||
//[clone_ptr_base_derived
|
||||
class Base
|
||||
@ -152,3 +153,5 @@ int main()
|
||||
//]
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -9,8 +9,10 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[construct_forward_example
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
#include <iostream>
|
||||
|
||||
class copyable_only_tester
|
||||
@ -103,3 +105,5 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2008-2009.
|
||||
// (C) Copyright Ion Gaztanaga 2008-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)
|
||||
@ -9,9 +9,11 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[file_descriptor_def
|
||||
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
class file_descriptor
|
||||
@ -85,3 +87,5 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -20,8 +20,10 @@ int main()
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[how_works_example
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <iostream>
|
||||
|
||||
class sink_tester
|
||||
@ -56,5 +58,6 @@ int main()
|
||||
}
|
||||
//]
|
||||
|
||||
#endif
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -9,8 +9,11 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[move_algorithms_example
|
||||
#include "movable.hpp"
|
||||
#include <boost/move/algorithm.hpp>
|
||||
#include <cassert>
|
||||
#include <boost/aligned_storage.hpp>
|
||||
|
||||
@ -39,3 +42,5 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -9,10 +9,13 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[move_inserter_example
|
||||
#include <boost/container/list.hpp>
|
||||
#include "movable.hpp"
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace ::boost::container;
|
||||
|
||||
@ -27,10 +30,9 @@ void test_move_inserter(list_t &l2, MoveInsertIterator mit)
|
||||
assert(!l.begin()->moved());
|
||||
l2.clear();
|
||||
|
||||
//Move construct
|
||||
for(l_iterator itbeg = l.begin(), itend = l.end(); itbeg != itend; ++itbeg){
|
||||
*mit = *itbeg;
|
||||
}
|
||||
//Move insert into l2 containers
|
||||
std::copy(l.begin(), l.end(), mit);
|
||||
|
||||
//Check size and status
|
||||
assert(l2.size() == l.size());
|
||||
assert(l.begin()->moved());
|
||||
@ -46,3 +48,5 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -8,7 +8,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
//[move_iterator_example
|
||||
#include <boost/container/vector.hpp>
|
||||
#include "movable.hpp"
|
||||
@ -37,3 +37,5 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
@ -11,9 +11,12 @@
|
||||
#ifndef BOOST_MOVE_TEST_MOVABLE_HPP
|
||||
#define BOOST_MOVE_TEST_MOVABLE_HPP
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
//[movable_definition
|
||||
//header file "movable.hpp"
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/traits.hpp>
|
||||
|
||||
//A movable class
|
||||
class movable
|
||||
@ -46,4 +49,6 @@ struct has_nothrow_move<movable>
|
||||
} //namespace boost{
|
||||
//]
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_MOVE_TEST_MOVABLE_HPP
|
||||
|
@ -1,52 +1,4 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "construct_forward_test", "construct_forward_test.vcproj", "{CD57C283-1862-42FE-BF87-B96D3A2A7912}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "move_iterator_test", "move_iterator_test.vcproj", "{C8AD2618-79EB-8612-42FE-2A3AC9667A13}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "move_test", "move_test.vcproj", "{CD57C283-1862-42FE-BF87-B96D3A2A7912}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "move_algorithm_test", "move_algorithm.vcproj", "{C8AD2618-79EB-8612-42FE-2A3AC9667A13}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_clone_ptr", "doc_clone_ptr.vcproj", "{CD57C283-1862-42FE-BF87-B96D3A2A7912}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_file_descriptor", "doc_file_descriptor.vcproj", "{CD57C283-1862-42FE-BF87-B96D3A2A7912}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_move_iterator", "doc_move_iterator.vcproj", "{CD57C283-1862-42FE-BF87-B96D3A2A7912}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_move_inserter", "doc_move_inserter.vcproj", "{CD57C283-1862-42FE-BF87-B96D3A2A7912}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_move_algorithms", "doc_move_algorithms.vcproj", "{CD57C283-1862-42FE-BF87-B96D3A2A7912}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_construct_forward", "doc_construct_forward.vcproj", "{CD57C283-1862-42FE-BF87-B96D3A2A7912}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "back_move_inserter_test", "back_move_inserter_test.vcproj", "{C8AD2618-79EB-8612-42FE-2A3AC9667A13}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "copy_move_optimization_test", "copy_move_optimization.vcproj", "{C8AD2618-79EB-8612-42FE-2A3AC9667A13}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "copy_elision_test_test", "copy_elision_test.vcproj", "{C8AD2618-79EB-8612-42FE-2A3AC9667A13}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
@ -67,54 +19,6 @@ Global
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.ActiveCfg = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.Build.0 = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.ActiveCfg = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.ActiveCfg = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.Build.0 = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.ActiveCfg = Release|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.Build.0 = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.ActiveCfg = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.Build.0 = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.ActiveCfg = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.ActiveCfg = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.Build.0 = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.ActiveCfg = Release|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.Build.0 = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.ActiveCfg = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.Build.0 = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.ActiveCfg = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.ActiveCfg = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.Build.0 = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.ActiveCfg = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.ActiveCfg = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.Build.0 = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.ActiveCfg = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.ActiveCfg = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.Build.0 = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.ActiveCfg = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.ActiveCfg = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.Build.0 = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.ActiveCfg = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.ActiveCfg = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.Build.0 = Debug|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.ActiveCfg = Release|Win32
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.ActiveCfg = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.Build.0 = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.ActiveCfg = Release|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.Build.0 = Release|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.ActiveCfg = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.Build.0 = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.ActiveCfg = Release|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.Build.0 = Release|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.ActiveCfg = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.Build.0 = Debug|Win32
|
||||
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.ActiveCfg = Release|Win32
|
||||
@ -129,10 +33,18 @@ Global
|
||||
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionItems) = postSolution
|
||||
..\..\..\..\boost\move\algorithm.hpp = ..\..\..\..\boost\move\algorithm.hpp
|
||||
..\..\..\..\boost\move\detail\config_begin.hpp = ..\..\..\..\boost\move\detail\config_begin.hpp
|
||||
..\..\..\..\boost\move\detail\config_end.hpp = ..\..\..\..\boost\move\detail\config_end.hpp
|
||||
..\..\..\..\boost\move\core.hpp = ..\..\..\..\boost\move\core.hpp
|
||||
..\..\..\..\boost\move\iterator.hpp = ..\..\..\..\boost\move\iterator.hpp
|
||||
..\..\doc\Jamfile.v2 = ..\..\doc\Jamfile.v2
|
||||
..\..\..\..\boost\move\detail\meta_utils.hpp = ..\..\..\..\boost\move\detail\meta_utils.hpp
|
||||
..\..\..\..\boost\move\move.hpp = ..\..\..\..\boost\move\move.hpp
|
||||
..\..\doc\move.qbk = ..\..\doc\move.qbk
|
||||
..\..\..\..\boost\move\move_helpers.hpp = ..\..\..\..\boost\move\move_helpers.hpp
|
||||
..\..\..\..\boost\move\detail\move_helpers.hpp = ..\..\..\..\boost\move\detail\move_helpers.hpp
|
||||
..\..\..\..\boost\move\traits.hpp = ..\..\..\..\boost\move\traits.hpp
|
||||
..\..\..\..\boost\move\utility.hpp = ..\..\..\..\boost\move\utility.hpp
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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