From fb70dadc596aced9840d6934f0ec0a6b7506d4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 24 Nov 2012 21:03:23 +0000 Subject: [PATCH] * 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] --- doc/Jamfile.v2 | 2 +- doc/move.qbk | 15 ++++- example/copymovable.hpp | 6 +- example/doc_clone_ptr.cpp | 5 +- example/doc_construct_forward.cpp | 6 +- example/doc_file_descriptor.cpp | 8 ++- example/doc_how_works.cpp | 9 ++- example/doc_move_algorithms.cpp | 5 ++ example/doc_move_inserter.cpp | 12 ++-- example/doc_move_iterator.cpp | 4 +- example/movable.hpp | 7 +- proj/vc7ide/Move.sln | 106 +++--------------------------- test/back_move_inserter.cpp | 5 +- test/construct_forward.cpp | 24 +++---- test/conversion_test.cpp | 20 +++--- test/copy_elision_test.cpp | 13 ++-- test/copy_move_optimization.cpp | 4 +- test/move.cpp | 8 ++- test/move_algorithm.cpp | 5 +- test/move_iterator.cpp | 55 +--------------- 20 files changed, 122 insertions(+), 197 deletions(-) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 55c1702..f970d61 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -13,7 +13,7 @@ import quickbook ; doxygen autodoc : - [ glob ../../../boost/move/move.hpp ] + [ glob ../../../boost/move/*.hpp ] : HIDE_UNDOC_MEMBERS=YES HIDE_UNDOC_MEMBERS=YES diff --git a/doc/move.qbk b/doc/move.qbk index 7224176..e4591c1 100644 --- a/doc/move.qbk +++ b/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 diff --git a/example/copymovable.hpp b/example/copymovable.hpp index c3b4793..cb2c050 100644 --- a/example/copymovable.hpp +++ b/example/copymovable.hpp @@ -11,9 +11,11 @@ #ifndef BOOST_MOVE_TEST_COPYMOVABLE_HPP #define BOOST_MOVE_TEST_COPYMOVABLE_HPP +#include + //[movable_definition //header file "copy_movable.hpp" -#include +#include //A copy_movable class class copy_movable @@ -43,4 +45,6 @@ class copy_movable //] +#include + #endif //BOOST_MOVE_TEST_COPYMOVABLE_HPP diff --git a/example/doc_clone_ptr.cpp b/example/doc_clone_ptr.cpp index 56c0816..976b142 100644 --- a/example/doc_clone_ptr.cpp +++ b/example/doc_clone_ptr.cpp @@ -8,7 +8,8 @@ // See http://www.boost.org/libs/move for documentation. // ////////////////////////////////////////////////////////////////////////////// -#include +#include +#include //[clone_ptr_base_derived class Base @@ -152,3 +153,5 @@ int main() //] return 0; } + +#include diff --git a/example/doc_construct_forward.cpp b/example/doc_construct_forward.cpp index 07be958..4eee536 100644 --- a/example/doc_construct_forward.cpp +++ b/example/doc_construct_forward.cpp @@ -9,8 +9,10 @@ // ////////////////////////////////////////////////////////////////////////////// +#include + //[construct_forward_example -#include +#include #include class copyable_only_tester @@ -103,3 +105,5 @@ int main() return 0; } //] + +#include diff --git a/example/doc_file_descriptor.cpp b/example/doc_file_descriptor.cpp index 6d008d3..e4e6ba3 100644 --- a/example/doc_file_descriptor.cpp +++ b/example/doc_file_descriptor.cpp @@ -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 + //[file_descriptor_def -#include +#include #include class file_descriptor @@ -85,3 +87,5 @@ int main() return 0; } //] + +#include diff --git a/example/doc_how_works.cpp b/example/doc_how_works.cpp index e2116c5..ef28be4 100644 --- a/example/doc_how_works.cpp +++ b/example/doc_how_works.cpp @@ -11,7 +11,7 @@ #include -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) int main() { @@ -20,8 +20,10 @@ int main() #else +#include + //[how_works_example -#include +#include #include class sink_tester @@ -56,5 +58,6 @@ int main() } //] -#endif +#include +#endif diff --git a/example/doc_move_algorithms.cpp b/example/doc_move_algorithms.cpp index c9ca065..6fe487a 100644 --- a/example/doc_move_algorithms.cpp +++ b/example/doc_move_algorithms.cpp @@ -9,8 +9,11 @@ // ////////////////////////////////////////////////////////////////////////////// +#include + //[move_algorithms_example #include "movable.hpp" +#include #include #include @@ -39,3 +42,5 @@ int main() return 0; } //] + +#include diff --git a/example/doc_move_inserter.cpp b/example/doc_move_inserter.cpp index 1e0b9dc..c715412 100644 --- a/example/doc_move_inserter.cpp +++ b/example/doc_move_inserter.cpp @@ -9,10 +9,13 @@ // ////////////////////////////////////////////////////////////////////////////// +#include + //[move_inserter_example #include #include "movable.hpp" #include +#include 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 diff --git a/example/doc_move_iterator.cpp b/example/doc_move_iterator.cpp index 0e7cc51..86d3893 100644 --- a/example/doc_move_iterator.cpp +++ b/example/doc_move_iterator.cpp @@ -8,7 +8,7 @@ // See http://www.boost.org/libs/move for documentation. // ////////////////////////////////////////////////////////////////////////////// - +#include //[move_iterator_example #include #include "movable.hpp" @@ -37,3 +37,5 @@ int main() return 0; } //] + +#include diff --git a/example/movable.hpp b/example/movable.hpp index 89b4397..07912dd 100644 --- a/example/movable.hpp +++ b/example/movable.hpp @@ -11,9 +11,12 @@ #ifndef BOOST_MOVE_TEST_MOVABLE_HPP #define BOOST_MOVE_TEST_MOVABLE_HPP +#include + //[movable_definition //header file "movable.hpp" -#include +#include +#include //A movable class class movable @@ -46,4 +49,6 @@ struct has_nothrow_move } //namespace boost{ //] +#include + #endif //BOOST_MOVE_TEST_MOVABLE_HPP diff --git a/proj/vc7ide/Move.sln b/proj/vc7ide/Move.sln index 894918a..4e2b273 100644 --- a/proj/vc7ide/Move.sln +++ b/proj/vc7ide/Move.sln @@ -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 diff --git a/test/back_move_inserter.cpp b/test/back_move_inserter.cpp index 1505125..eeddd6b 100644 --- a/test/back_move_inserter.cpp +++ b/test/back_move_inserter.cpp @@ -8,7 +8,8 @@ // See http://www.boost.org/libs/move for documentation. // ////////////////////////////////////////////////////////////////////////////// -#include +#include +#include #include #include #include @@ -72,3 +73,5 @@ int main() } return 0; } + +#include diff --git a/test/construct_forward.cpp b/test/construct_forward.cpp index bf4c526..6922d82 100644 --- a/test/construct_forward.cpp +++ b/test/construct_forward.cpp @@ -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 +#include +#include #include #include "../example/movable.hpp" #include "../example/copymovable.hpp" @@ -24,36 +24,36 @@ class non_movable template 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 >::type* = 0 - #endif //BOOST_NO_RVALUE_REFERENCES + #endif //BOOST_NO_CXX11_RVALUE_REFERENCES ) { (void)x;} template 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 >::type* = 0 - #endif //BOOST_NO_RVALUE_REFERENCES + #endif //BOOST_NO_CXX11_RVALUE_REFERENCES ) { (void)x;} template 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 >::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 void catch_test(const MaybeRvalue& x ,typename ::boost::disable_if< ::boost::has_move_emulation_enabled >::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 diff --git a/test/conversion_test.cpp b/test/conversion_test.cpp index 99157c1..5c973d7 100644 --- a/test/conversion_test.cpp +++ b/test/conversion_test.cpp @@ -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 +#include +#include #include #include #include -#include +#include +#include enum ConstructionType { Copied, Moved, Other }; @@ -105,11 +107,11 @@ class container template void priv_push_back(BOOST_MOVE_CATCH_FWD(U) x) - { new (&storage_) T(::boost::forward(x)); } + { ::new (&storage_) T(::boost::forward(x)); } template iterator priv_insert(const_iterator, BOOST_MOVE_CATCH_FWD(U) x) - { new (&storage_) T(::boost::forward(x)); return 0; } + { ::new (&storage_) T(::boost::forward(x)); return 0; } }; @@ -292,8 +294,10 @@ int main() return 0; } +#include + /* -#include +#include #include #include #include @@ -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, 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(x)); } diff --git a/test/copy_elision_test.cpp b/test/copy_elision_test.cpp index 01bf212..b15ebf2 100644 --- a/test/copy_elision_test.cpp +++ b/test/copy_elision_test.cpp @@ -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 #include #ifdef NO_MOVE @@ -11,7 +12,7 @@ # define BOOST_COPYABLE_AND_MOVABLE(X) # define MOVE(x) (x) #else -#include +#include # 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 diff --git a/test/copy_move_optimization.cpp b/test/copy_move_optimization.cpp index 10a0f20..4702a6f 100644 --- a/test/copy_move_optimization.cpp +++ b/test/copy_move_optimization.cpp @@ -8,7 +8,8 @@ //Optimization: //Since RVO is better than move-construction, //avoid copy constructor overloading. -#include +#include +#include #include bool moved = false; @@ -103,3 +104,4 @@ int main() //1 const rv & constructor: copy constructor //1 T & constructor: copy constructor +#include diff --git a/test/move.cpp b/test/move.cpp index e3e3790..e0e21f1 100644 --- a/test/move.cpp +++ b/test/move.cpp @@ -8,8 +8,8 @@ // See http://www.boost.org/libs/move for documentation. // ////////////////////////////////////////////////////////////////////////////// - -#include +#include +#include #include "../example/movable.hpp" #include @@ -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::value == true)); BOOST_STATIC_ASSERT((boost::has_nothrow_move::value == false)); BOOST_STATIC_ASSERT((boost::has_move_emulation_enabled::value == false)); @@ -112,3 +112,5 @@ int main() return 0; } + +#include diff --git a/test/move_algorithm.cpp b/test/move_algorithm.cpp index 0568f7c..d3944b1 100644 --- a/test/move_algorithm.cpp +++ b/test/move_algorithm.cpp @@ -8,7 +8,8 @@ // See http://www.boost.org/libs/move for documentation. // ////////////////////////////////////////////////////////////////////////////// -#include +#include +#include #include #include "../example/movable.hpp" @@ -53,3 +54,5 @@ int main() return 0; } + +#include diff --git a/test/move_iterator.cpp b/test/move_iterator.cpp index 10cc2bd..37c39f3 100644 --- a/test/move_iterator.cpp +++ b/test/move_iterator.cpp @@ -8,8 +8,8 @@ // See http://www.boost.org/libs/move for documentation. // ////////////////////////////////////////////////////////////////////////////// - -#include +#include +#include #include #include "../example/movable.hpp" @@ -52,53 +52,4 @@ int main() return 0; } -/* -#include - - -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; -} -*/ \ No newline at end of file +#include