Movable unordered containers, full support only for compilers with rvalue references.
Merged revisions 44076-44414 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
r44076 | danieljames | 2008-04-06 20:41:19 +0100 (Sun, 06 Apr 2008) | 1 line
Move semantics for compilers with rvalue references.
........
r44077 | danieljames | 2008-04-06 20:48:59 +0100 (Sun, 06 Apr 2008) | 1 line
Do move assignment 'properly'.
........
r44085 | danieljames | 2008-04-06 22:46:04 +0100 (Sun, 06 Apr 2008) | 1 line
Use normal references for the move members, reset the source buckets_ pointer to stop the buckets getting deleted, and remove a superflous pointer check.
........
r44109 | danieljames | 2008-04-07 23:49:36 +0100 (Mon, 07 Apr 2008) | 1 line
Add missing tests.
........
r44366 | danieljames | 2008-04-13 12:59:46 +0100 (Sun, 13 Apr 2008) | 1 line
Avoid using rvalue references in the implementation files.
........
r44368 | danieljames | 2008-04-13 15:13:33 +0100 (Sun, 13 Apr 2008) | 6 lines
Use a cut down version of the work in progress move library to implement move
semantics on more compilers. Unfortunately the move constructor with allocator
isn't really practical at the moment, since in the case where the container
can't be moved, and the allocators aren't equal it will copy the container
twice.
........
[SVN r44486]
2008-04-17 07:34:15 +00:00
|
|
|
/*
|
|
|
|
|
Copyright 2005-2007 Adobe Systems Incorporated
|
|
|
|
|
|
|
|
|
|
Use, modification and distribution are subject to 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).
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef BOOST_UNORDERED_DETAIL_MOVE_HEADER
|
|
|
|
|
#define BOOST_UNORDERED_DETAIL_MOVE_HEADER
|
|
|
|
|
|
New version of Boost.Unordered
Merged revisions 55470,55877-55878,55901-55902,55921-55922,55990-55992,56009-56010,56329,56346-56349,56362-56363,56374 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r55470 | danieljames | 2009-08-08 19:50:00 +0100 (Sat, 08 Aug 2009) | 1 line
Remove empty svn:mergeinfo properties. This should reduce the amount of differences between trunk and release.
........
r55877 | danieljames | 2009-08-30 17:33:42 +0100 (Sun, 30 Aug 2009) | 1 line
Remove allocator_constructor since it's never used.
........
r55878 | danieljames | 2009-08-30 17:42:28 +0100 (Sun, 30 Aug 2009) | 6 lines
Initial checkin of new version of Boost.Unordered.
- More template use, less preprocessor use.
- Removed some of the Visual C++ 6 workarounds.
- Reduced memory use of the main object.
- Split into smaller headers.
........
r55901 | danieljames | 2009-08-31 11:39:25 +0100 (Mon, 31 Aug 2009) | 1 line
Detab.
........
r55902 | danieljames | 2009-08-31 11:39:40 +0100 (Mon, 31 Aug 2009) | 1 line
Remove unnecessary BOOST_DEDUCED_TYPENAMEs
........
r55921 | danieljames | 2009-08-31 16:33:28 +0100 (Mon, 31 Aug 2009) | 1 line
Remove a few unused parameters.
........
r55922 | danieljames | 2009-08-31 16:33:49 +0100 (Mon, 31 Aug 2009) | 1 line
Remove 'static' from next_node and node_count. Will hopefully make vacpp happy.
........
r55990 | danieljames | 2009-09-03 08:36:21 +0100 (Thu, 03 Sep 2009) | 1 line
Combine hash_structure and hash_table_manager.
........
r55991 | danieljames | 2009-09-03 08:37:14 +0100 (Thu, 03 Sep 2009) | 1 line
Remove some old Visual C++ workarounds.
........
r55992 | danieljames | 2009-09-03 08:37:30 +0100 (Thu, 03 Sep 2009) | 1 line
Add a small test to see if the tested compilers support out of line template methods.
........
r56009 | danieljames | 2009-09-04 08:02:28 +0100 (Fri, 04 Sep 2009) | 1 line
Fix link to n2691.
........
r56010 | danieljames | 2009-09-04 08:03:04 +0100 (Fri, 04 Sep 2009) | 1 line
Move size_ and cached_begin_bucket_ into table, rename hash_table_manager hash_buckets.
........
r56329 | danieljames | 2009-09-20 22:55:15 +0100 (Sun, 20 Sep 2009) | 2 lines
Since all the compilers support out of line template members use them
and lots of other things.
........
r56346 | danieljames | 2009-09-21 22:17:19 +0100 (Mon, 21 Sep 2009) | 1 line
Slightly more consistent variable names. In detail 'n' is now always a node pointer.
........
r56347 | danieljames | 2009-09-21 22:17:40 +0100 (Mon, 21 Sep 2009) | 1 line
Fix bug where container was reducing the number of buckets.
........
r56348 | danieljames | 2009-09-21 22:18:01 +0100 (Mon, 21 Sep 2009) | 1 line
Fix a bug that was causing unnecessary rehahes.
........
r56349 | danieljames | 2009-09-21 22:18:21 +0100 (Mon, 21 Sep 2009) | 1 line
Use std::max.
........
r56362 | danieljames | 2009-09-22 23:39:00 +0100 (Tue, 22 Sep 2009) | 1 line
Another std::max.
........
r56363 | danieljames | 2009-09-22 23:39:17 +0100 (Tue, 22 Sep 2009) | 1 line
Remove the emplace_hint implementation for unique containers as it isn't really used and seems to be causing sun 5.7 problems.
........
r56374 | danieljames | 2009-09-24 21:42:19 +0100 (Thu, 24 Sep 2009) | 1 line
Remove temporary test.
........
[SVN r56375]
2009-09-24 21:12:46 +00:00
|
|
|
#include <boost/config.hpp>
|
Movable unordered containers, full support only for compilers with rvalue references.
Merged revisions 44076-44414 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
r44076 | danieljames | 2008-04-06 20:41:19 +0100 (Sun, 06 Apr 2008) | 1 line
Move semantics for compilers with rvalue references.
........
r44077 | danieljames | 2008-04-06 20:48:59 +0100 (Sun, 06 Apr 2008) | 1 line
Do move assignment 'properly'.
........
r44085 | danieljames | 2008-04-06 22:46:04 +0100 (Sun, 06 Apr 2008) | 1 line
Use normal references for the move members, reset the source buckets_ pointer to stop the buckets getting deleted, and remove a superflous pointer check.
........
r44109 | danieljames | 2008-04-07 23:49:36 +0100 (Mon, 07 Apr 2008) | 1 line
Add missing tests.
........
r44366 | danieljames | 2008-04-13 12:59:46 +0100 (Sun, 13 Apr 2008) | 1 line
Avoid using rvalue references in the implementation files.
........
r44368 | danieljames | 2008-04-13 15:13:33 +0100 (Sun, 13 Apr 2008) | 6 lines
Use a cut down version of the work in progress move library to implement move
semantics on more compilers. Unfortunately the move constructor with allocator
isn't really practical at the moment, since in the case where the container
can't be moved, and the allocators aren't equal it will copy the container
twice.
........
[SVN r44486]
2008-04-17 07:34:15 +00:00
|
|
|
#include <boost/mpl/bool.hpp>
|
|
|
|
|
#include <boost/mpl/and.hpp>
|
|
|
|
|
#include <boost/mpl/or.hpp>
|
|
|
|
|
#include <boost/mpl/not.hpp>
|
|
|
|
|
#include <boost/type_traits/is_convertible.hpp>
|
|
|
|
|
#include <boost/type_traits/is_same.hpp>
|
|
|
|
|
#include <boost/type_traits/is_class.hpp>
|
|
|
|
|
#include <boost/utility/enable_if.hpp>
|
New version of Boost.Unordered
Merged revisions 55470,55877-55878,55901-55902,55921-55922,55990-55992,56009-56010,56329,56346-56349,56362-56363,56374 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r55470 | danieljames | 2009-08-08 19:50:00 +0100 (Sat, 08 Aug 2009) | 1 line
Remove empty svn:mergeinfo properties. This should reduce the amount of differences between trunk and release.
........
r55877 | danieljames | 2009-08-30 17:33:42 +0100 (Sun, 30 Aug 2009) | 1 line
Remove allocator_constructor since it's never used.
........
r55878 | danieljames | 2009-08-30 17:42:28 +0100 (Sun, 30 Aug 2009) | 6 lines
Initial checkin of new version of Boost.Unordered.
- More template use, less preprocessor use.
- Removed some of the Visual C++ 6 workarounds.
- Reduced memory use of the main object.
- Split into smaller headers.
........
r55901 | danieljames | 2009-08-31 11:39:25 +0100 (Mon, 31 Aug 2009) | 1 line
Detab.
........
r55902 | danieljames | 2009-08-31 11:39:40 +0100 (Mon, 31 Aug 2009) | 1 line
Remove unnecessary BOOST_DEDUCED_TYPENAMEs
........
r55921 | danieljames | 2009-08-31 16:33:28 +0100 (Mon, 31 Aug 2009) | 1 line
Remove a few unused parameters.
........
r55922 | danieljames | 2009-08-31 16:33:49 +0100 (Mon, 31 Aug 2009) | 1 line
Remove 'static' from next_node and node_count. Will hopefully make vacpp happy.
........
r55990 | danieljames | 2009-09-03 08:36:21 +0100 (Thu, 03 Sep 2009) | 1 line
Combine hash_structure and hash_table_manager.
........
r55991 | danieljames | 2009-09-03 08:37:14 +0100 (Thu, 03 Sep 2009) | 1 line
Remove some old Visual C++ workarounds.
........
r55992 | danieljames | 2009-09-03 08:37:30 +0100 (Thu, 03 Sep 2009) | 1 line
Add a small test to see if the tested compilers support out of line template methods.
........
r56009 | danieljames | 2009-09-04 08:02:28 +0100 (Fri, 04 Sep 2009) | 1 line
Fix link to n2691.
........
r56010 | danieljames | 2009-09-04 08:03:04 +0100 (Fri, 04 Sep 2009) | 1 line
Move size_ and cached_begin_bucket_ into table, rename hash_table_manager hash_buckets.
........
r56329 | danieljames | 2009-09-20 22:55:15 +0100 (Sun, 20 Sep 2009) | 2 lines
Since all the compilers support out of line template members use them
and lots of other things.
........
r56346 | danieljames | 2009-09-21 22:17:19 +0100 (Mon, 21 Sep 2009) | 1 line
Slightly more consistent variable names. In detail 'n' is now always a node pointer.
........
r56347 | danieljames | 2009-09-21 22:17:40 +0100 (Mon, 21 Sep 2009) | 1 line
Fix bug where container was reducing the number of buckets.
........
r56348 | danieljames | 2009-09-21 22:18:01 +0100 (Mon, 21 Sep 2009) | 1 line
Fix a bug that was causing unnecessary rehahes.
........
r56349 | danieljames | 2009-09-21 22:18:21 +0100 (Mon, 21 Sep 2009) | 1 line
Use std::max.
........
r56362 | danieljames | 2009-09-22 23:39:00 +0100 (Tue, 22 Sep 2009) | 1 line
Another std::max.
........
r56363 | danieljames | 2009-09-22 23:39:17 +0100 (Tue, 22 Sep 2009) | 1 line
Remove the emplace_hint implementation for unique containers as it isn't really used and seems to be causing sun 5.7 problems.
........
r56374 | danieljames | 2009-09-24 21:42:19 +0100 (Thu, 24 Sep 2009) | 1 line
Remove temporary test.
........
[SVN r56375]
2009-09-24 21:12:46 +00:00
|
|
|
#include <boost/detail/workaround.hpp>
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#if defined(BOOST_NO_SFINAE)
|
|
|
|
|
# define BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN
|
|
|
|
|
#elif defined(__GNUC__) && \
|
|
|
|
|
(__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
|
|
|
|
|
# define BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN
|
|
|
|
|
#elif BOOST_WORKAROUND(BOOST_INTEL, < 900) || \
|
|
|
|
|
BOOST_WORKAROUND(__EDG_VERSION__, < 304) || \
|
|
|
|
|
BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0593))
|
|
|
|
|
# define BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN
|
|
|
|
|
#endif
|
Movable unordered containers, full support only for compilers with rvalue references.
Merged revisions 44076-44414 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
r44076 | danieljames | 2008-04-06 20:41:19 +0100 (Sun, 06 Apr 2008) | 1 line
Move semantics for compilers with rvalue references.
........
r44077 | danieljames | 2008-04-06 20:48:59 +0100 (Sun, 06 Apr 2008) | 1 line
Do move assignment 'properly'.
........
r44085 | danieljames | 2008-04-06 22:46:04 +0100 (Sun, 06 Apr 2008) | 1 line
Use normal references for the move members, reset the source buckets_ pointer to stop the buckets getting deleted, and remove a superflous pointer check.
........
r44109 | danieljames | 2008-04-07 23:49:36 +0100 (Mon, 07 Apr 2008) | 1 line
Add missing tests.
........
r44366 | danieljames | 2008-04-13 12:59:46 +0100 (Sun, 13 Apr 2008) | 1 line
Avoid using rvalue references in the implementation files.
........
r44368 | danieljames | 2008-04-13 15:13:33 +0100 (Sun, 13 Apr 2008) | 6 lines
Use a cut down version of the work in progress move library to implement move
semantics on more compilers. Unfortunately the move constructor with allocator
isn't really practical at the moment, since in the case where the container
can't be moved, and the allocators aren't equal it will copy the container
twice.
........
[SVN r44486]
2008-04-17 07:34:15 +00:00
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
namespace boost {
|
|
|
|
|
namespace unordered_detail {
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
namespace move_detail {
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#if !defined(BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN)
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
struct class_has_move_assign {
|
|
|
|
|
class type {
|
|
|
|
|
typedef T& (T::*E)(T t);
|
|
|
|
|
typedef char (&no_type)[1];
|
|
|
|
|
typedef char (&yes_type)[2];
|
|
|
|
|
template <E e> struct sfinae { typedef yes_type type; };
|
|
|
|
|
template <class U>
|
|
|
|
|
static typename sfinae<&U::operator=>::type test(int);
|
|
|
|
|
template <class U>
|
|
|
|
|
static no_type test(...);
|
|
|
|
|
public:
|
|
|
|
|
enum {value = sizeof(test<T>(1)) == sizeof(yes_type)};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
struct has_move_assign : boost::mpl::and_<boost::is_class<T>, class_has_move_assign<T> > {};
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
class test_can_convert_anything { };
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#endif // BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*
|
2008-04-20 12:11:22 +00:00
|
|
|
REVISIT (sparent@adobe.com): This is a work around for Boost 1.34.1 and VC++ 2008 where
|
|
|
|
|
boost::is_convertible<T, T> fails to compile.
|
Movable unordered containers, full support only for compilers with rvalue references.
Merged revisions 44076-44414 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
r44076 | danieljames | 2008-04-06 20:41:19 +0100 (Sun, 06 Apr 2008) | 1 line
Move semantics for compilers with rvalue references.
........
r44077 | danieljames | 2008-04-06 20:48:59 +0100 (Sun, 06 Apr 2008) | 1 line
Do move assignment 'properly'.
........
r44085 | danieljames | 2008-04-06 22:46:04 +0100 (Sun, 06 Apr 2008) | 1 line
Use normal references for the move members, reset the source buckets_ pointer to stop the buckets getting deleted, and remove a superflous pointer check.
........
r44109 | danieljames | 2008-04-07 23:49:36 +0100 (Mon, 07 Apr 2008) | 1 line
Add missing tests.
........
r44366 | danieljames | 2008-04-13 12:59:46 +0100 (Sun, 13 Apr 2008) | 1 line
Avoid using rvalue references in the implementation files.
........
r44368 | danieljames | 2008-04-13 15:13:33 +0100 (Sun, 13 Apr 2008) | 6 lines
Use a cut down version of the work in progress move library to implement move
semantics on more compilers. Unfortunately the move constructor with allocator
isn't really practical at the moment, since in the case where the container
can't be moved, and the allocators aren't equal it will copy the container
twice.
........
[SVN r44486]
2008-04-17 07:34:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
template <typename T, typename U>
|
|
|
|
|
struct is_convertible : boost::mpl::or_<
|
2008-04-20 12:11:22 +00:00
|
|
|
boost::is_same<T, U>,
|
|
|
|
|
boost::is_convertible<T, U>
|
Movable unordered containers, full support only for compilers with rvalue references.
Merged revisions 44076-44414 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
r44076 | danieljames | 2008-04-06 20:41:19 +0100 (Sun, 06 Apr 2008) | 1 line
Move semantics for compilers with rvalue references.
........
r44077 | danieljames | 2008-04-06 20:48:59 +0100 (Sun, 06 Apr 2008) | 1 line
Do move assignment 'properly'.
........
r44085 | danieljames | 2008-04-06 22:46:04 +0100 (Sun, 06 Apr 2008) | 1 line
Use normal references for the move members, reset the source buckets_ pointer to stop the buckets getting deleted, and remove a superflous pointer check.
........
r44109 | danieljames | 2008-04-07 23:49:36 +0100 (Mon, 07 Apr 2008) | 1 line
Add missing tests.
........
r44366 | danieljames | 2008-04-13 12:59:46 +0100 (Sun, 13 Apr 2008) | 1 line
Avoid using rvalue references in the implementation files.
........
r44368 | danieljames | 2008-04-13 15:13:33 +0100 (Sun, 13 Apr 2008) | 6 lines
Use a cut down version of the work in progress move library to implement move
semantics on more compilers. Unfortunately the move constructor with allocator
isn't really practical at the moment, since in the case where the container
can't be moved, and the allocators aren't equal it will copy the container
twice.
........
[SVN r44486]
2008-04-17 07:34:15 +00:00
|
|
|
> { };
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
} //namespace move_detail
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\ingroup move_related
|
|
|
|
|
\brief move_from is used for move_ctors.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
struct move_from
|
|
|
|
|
{
|
|
|
|
|
explicit move_from(T& x) : source(x) { }
|
|
|
|
|
T& source;
|
New version of Boost.Unordered
Merged revisions 55470,55877-55878,55901-55902,55921-55922,55990-55992,56009-56010,56329,56346-56349,56362-56363,56374 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r55470 | danieljames | 2009-08-08 19:50:00 +0100 (Sat, 08 Aug 2009) | 1 line
Remove empty svn:mergeinfo properties. This should reduce the amount of differences between trunk and release.
........
r55877 | danieljames | 2009-08-30 17:33:42 +0100 (Sun, 30 Aug 2009) | 1 line
Remove allocator_constructor since it's never used.
........
r55878 | danieljames | 2009-08-30 17:42:28 +0100 (Sun, 30 Aug 2009) | 6 lines
Initial checkin of new version of Boost.Unordered.
- More template use, less preprocessor use.
- Removed some of the Visual C++ 6 workarounds.
- Reduced memory use of the main object.
- Split into smaller headers.
........
r55901 | danieljames | 2009-08-31 11:39:25 +0100 (Mon, 31 Aug 2009) | 1 line
Detab.
........
r55902 | danieljames | 2009-08-31 11:39:40 +0100 (Mon, 31 Aug 2009) | 1 line
Remove unnecessary BOOST_DEDUCED_TYPENAMEs
........
r55921 | danieljames | 2009-08-31 16:33:28 +0100 (Mon, 31 Aug 2009) | 1 line
Remove a few unused parameters.
........
r55922 | danieljames | 2009-08-31 16:33:49 +0100 (Mon, 31 Aug 2009) | 1 line
Remove 'static' from next_node and node_count. Will hopefully make vacpp happy.
........
r55990 | danieljames | 2009-09-03 08:36:21 +0100 (Thu, 03 Sep 2009) | 1 line
Combine hash_structure and hash_table_manager.
........
r55991 | danieljames | 2009-09-03 08:37:14 +0100 (Thu, 03 Sep 2009) | 1 line
Remove some old Visual C++ workarounds.
........
r55992 | danieljames | 2009-09-03 08:37:30 +0100 (Thu, 03 Sep 2009) | 1 line
Add a small test to see if the tested compilers support out of line template methods.
........
r56009 | danieljames | 2009-09-04 08:02:28 +0100 (Fri, 04 Sep 2009) | 1 line
Fix link to n2691.
........
r56010 | danieljames | 2009-09-04 08:03:04 +0100 (Fri, 04 Sep 2009) | 1 line
Move size_ and cached_begin_bucket_ into table, rename hash_table_manager hash_buckets.
........
r56329 | danieljames | 2009-09-20 22:55:15 +0100 (Sun, 20 Sep 2009) | 2 lines
Since all the compilers support out of line template members use them
and lots of other things.
........
r56346 | danieljames | 2009-09-21 22:17:19 +0100 (Mon, 21 Sep 2009) | 1 line
Slightly more consistent variable names. In detail 'n' is now always a node pointer.
........
r56347 | danieljames | 2009-09-21 22:17:40 +0100 (Mon, 21 Sep 2009) | 1 line
Fix bug where container was reducing the number of buckets.
........
r56348 | danieljames | 2009-09-21 22:18:01 +0100 (Mon, 21 Sep 2009) | 1 line
Fix a bug that was causing unnecessary rehahes.
........
r56349 | danieljames | 2009-09-21 22:18:21 +0100 (Mon, 21 Sep 2009) | 1 line
Use std::max.
........
r56362 | danieljames | 2009-09-22 23:39:00 +0100 (Tue, 22 Sep 2009) | 1 line
Another std::max.
........
r56363 | danieljames | 2009-09-22 23:39:17 +0100 (Tue, 22 Sep 2009) | 1 line
Remove the emplace_hint implementation for unique containers as it isn't really used and seems to be causing sun 5.7 problems.
........
r56374 | danieljames | 2009-09-24 21:42:19 +0100 (Thu, 24 Sep 2009) | 1 line
Remove temporary test.
........
[SVN r56375]
2009-09-24 21:12:46 +00:00
|
|
|
private:
|
|
|
|
|
move_from& operator=(move_from const&);
|
Movable unordered containers, full support only for compilers with rvalue references.
Merged revisions 44076-44414 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
r44076 | danieljames | 2008-04-06 20:41:19 +0100 (Sun, 06 Apr 2008) | 1 line
Move semantics for compilers with rvalue references.
........
r44077 | danieljames | 2008-04-06 20:48:59 +0100 (Sun, 06 Apr 2008) | 1 line
Do move assignment 'properly'.
........
r44085 | danieljames | 2008-04-06 22:46:04 +0100 (Sun, 06 Apr 2008) | 1 line
Use normal references for the move members, reset the source buckets_ pointer to stop the buckets getting deleted, and remove a superflous pointer check.
........
r44109 | danieljames | 2008-04-07 23:49:36 +0100 (Mon, 07 Apr 2008) | 1 line
Add missing tests.
........
r44366 | danieljames | 2008-04-13 12:59:46 +0100 (Sun, 13 Apr 2008) | 1 line
Avoid using rvalue references in the implementation files.
........
r44368 | danieljames | 2008-04-13 15:13:33 +0100 (Sun, 13 Apr 2008) | 6 lines
Use a cut down version of the work in progress move library to implement move
semantics on more compilers. Unfortunately the move constructor with allocator
isn't really practical at the moment, since in the case where the container
can't be moved, and the allocators aren't equal it will copy the container
twice.
........
[SVN r44486]
2008-04-17 07:34:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#if !defined(BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN)
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\ingroup move_related
|
|
|
|
|
\brief The is_movable trait can be used to identify movable types.
|
|
|
|
|
*/
|
|
|
|
|
template <typename T>
|
|
|
|
|
struct is_movable : boost::mpl::and_<
|
|
|
|
|
boost::is_convertible<move_from<T>, T>,
|
|
|
|
|
move_detail::has_move_assign<T>,
|
|
|
|
|
boost::mpl::not_<boost::is_convertible<move_detail::test_can_convert_anything, T> >
|
|
|
|
|
> { };
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#else // BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN
|
|
|
|
|
|
|
|
|
|
// On compilers which don't have adequate SFINAE support, treat most types as unmovable,
|
|
|
|
|
// unless the trait is specialized.
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
struct is_movable : boost::mpl::false_ { };
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#if !defined(BOOST_NO_SFINAE)
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\ingroup move_related
|
|
|
|
|
\brief copy_sink and move_sink are used to select between overloaded operations according to
|
|
|
|
|
whether type T is movable and convertible to type U.
|
|
|
|
|
\sa move
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
template <typename T,
|
|
|
|
|
typename U = T,
|
|
|
|
|
typename R = void*>
|
|
|
|
|
struct copy_sink : boost::enable_if<
|
|
|
|
|
boost::mpl::and_<
|
|
|
|
|
boost::unordered_detail::move_detail::is_convertible<T, U>,
|
|
|
|
|
boost::mpl::not_<is_movable<T> >
|
|
|
|
|
>,
|
|
|
|
|
R
|
|
|
|
|
>
|
|
|
|
|
{ };
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\ingroup move_related
|
|
|
|
|
\brief move_sink and copy_sink are used to select between overloaded operations according to
|
|
|
|
|
whether type T is movable and convertible to type U.
|
|
|
|
|
\sa move
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
template <typename T,
|
|
|
|
|
typename U = T,
|
|
|
|
|
typename R = void*>
|
|
|
|
|
struct move_sink : boost::enable_if<
|
|
|
|
|
boost::mpl::and_<
|
|
|
|
|
boost::unordered_detail::move_detail::is_convertible<T, U>,
|
|
|
|
|
is_movable<T>
|
|
|
|
|
>,
|
|
|
|
|
R
|
|
|
|
|
>
|
|
|
|
|
{ };
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\ingroup move_related
|
|
|
|
|
\brief This version of move is selected when T is_movable . It in turn calls the move
|
|
|
|
|
constructor. This call, with the help of the return value optimization, will cause x to be moved
|
|
|
|
|
instead of copied to its destination. See adobe/test/move/main.cpp for examples.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
template <typename T>
|
|
|
|
|
T move(T& x, typename move_sink<T>::type = 0) { return T(move_from<T>(x)); }
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\ingroup move_related
|
|
|
|
|
\brief This version of move is selected when T is not movable . The net result will be that
|
|
|
|
|
x gets copied.
|
|
|
|
|
*/
|
|
|
|
|
template <typename T>
|
|
|
|
|
T& move(T& x, typename copy_sink<T>::type = 0) { return x; }
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#else // BOOST_NO_SFINAE
|
|
|
|
|
|
|
|
|
|
// On compilers without SFINAE, define copy_sink to always use the copy function.
|
|
|
|
|
|
|
|
|
|
template <typename T,
|
|
|
|
|
typename U = T,
|
|
|
|
|
typename R = void*>
|
|
|
|
|
struct copy_sink
|
|
|
|
|
{
|
|
|
|
|
typedef R type;
|
2008-04-17 07:49:45 +00:00
|
|
|
};
|
Movable unordered containers, full support only for compilers with rvalue references.
Merged revisions 44076-44414 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
........
r44076 | danieljames | 2008-04-06 20:41:19 +0100 (Sun, 06 Apr 2008) | 1 line
Move semantics for compilers with rvalue references.
........
r44077 | danieljames | 2008-04-06 20:48:59 +0100 (Sun, 06 Apr 2008) | 1 line
Do move assignment 'properly'.
........
r44085 | danieljames | 2008-04-06 22:46:04 +0100 (Sun, 06 Apr 2008) | 1 line
Use normal references for the move members, reset the source buckets_ pointer to stop the buckets getting deleted, and remove a superflous pointer check.
........
r44109 | danieljames | 2008-04-07 23:49:36 +0100 (Mon, 07 Apr 2008) | 1 line
Add missing tests.
........
r44366 | danieljames | 2008-04-13 12:59:46 +0100 (Sun, 13 Apr 2008) | 1 line
Avoid using rvalue references in the implementation files.
........
r44368 | danieljames | 2008-04-13 15:13:33 +0100 (Sun, 13 Apr 2008) | 6 lines
Use a cut down version of the work in progress move library to implement move
semantics on more compilers. Unfortunately the move constructor with allocator
isn't really practical at the moment, since in the case where the container
can't be moved, and the allocators aren't equal it will copy the container
twice.
........
[SVN r44486]
2008-04-17 07:34:15 +00:00
|
|
|
|
|
|
|
|
// Always copy the element unless this is overloaded.
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
T& move(T& x) {
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // BOOST_NO_SFINAE
|
|
|
|
|
|
|
|
|
|
} // namespace unordered_detail
|
|
|
|
|
} // namespace boost
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|