forked from boostorg/container
Merged from trunk
[SVN r78115]
This commit is contained in:
1 parent
166f43004a
commit
ac9b5d15b4
74 files changed
+4479
-1250
No files matched your search
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2011-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,7 +9,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/container/allocator/allocator_traits.hpp>
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2005-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)
|
||||
//
|
||||
@@ -112,10 +112,10 @@ class dummy_test_allocator
|
||||
{}
|
||||
|
||||
pointer address(reference value)
|
||||
{ return pointer(addressof(value)); }
|
||||
{ return pointer(container_detail::addressof(value)); }
|
||||
|
||||
const_pointer address(const_reference value) const
|
||||
{ return const_pointer(addressof(value)); }
|
||||
{ return const_pointer(container_detail::addressof(value)); }
|
||||
|
||||
pointer allocate(size_type, cvoid_ptr = 0)
|
||||
{ return 0; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2005-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)
|
||||
//
|
||||
@@ -86,10 +86,10 @@ class expand_bwd_test_allocator
|
||||
, m_offset(other.m_offset), m_allocations(0){ }
|
||||
|
||||
pointer address(reference value)
|
||||
{ return pointer(addressof(value)); }
|
||||
{ return pointer(container_detail::addressof(value)); }
|
||||
|
||||
const_pointer address(const_reference value) const
|
||||
{ return const_pointer(addressof(value)); }
|
||||
{ return const_pointer(container_detail::addressof(value)); }
|
||||
|
||||
pointer allocate(size_type , cvoid_ptr hint = 0)
|
||||
{ (void)hint; return 0; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
@@ -228,17 +228,17 @@ class recursive_flat_multiset
|
||||
{
|
||||
public:
|
||||
recursive_flat_multiset(const recursive_flat_multiset &c)
|
||||
: id_(c.id_), flat_set_(c.flat_set_)
|
||||
: id_(c.id_), flat_multiset_(c.flat_multiset_)
|
||||
{}
|
||||
|
||||
recursive_flat_multiset & operator =(const recursive_flat_multiset &c)
|
||||
{
|
||||
id_ = c.id_;
|
||||
flat_set_= c.flat_set_;
|
||||
flat_multiset_= c.flat_multiset_;
|
||||
return *this;
|
||||
}
|
||||
int id_;
|
||||
flat_multiset<recursive_flat_multiset> flat_set_;
|
||||
flat_multiset<recursive_flat_multiset> flat_multiset_;
|
||||
friend bool operator< (const recursive_flat_multiset &a, const recursive_flat_multiset &b)
|
||||
{ return a.id_ < b.id_; }
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2005-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)
|
||||
//
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
|
||||
+11
-4
@@ -387,10 +387,17 @@ int map_test ()
|
||||
return 1;
|
||||
if(!CheckEqualPairContainers(boostmultimap, stdmultimap))
|
||||
return 1;
|
||||
{
|
||||
IntType i1(i);
|
||||
IntType i2(i);
|
||||
new(&intpair)IntPairType(boost::move(i1), boost::move(i2));
|
||||
{ //Check equal_range
|
||||
std::pair<typename MyBoostMultiMap::iterator, typename MyBoostMultiMap::iterator> bret =
|
||||
boostmultimap->equal_range(boostmultimap->begin()->first);
|
||||
|
||||
std::pair<typename MyStdMultiMap::iterator, typename MyStdMultiMap::iterator> sret =
|
||||
stdmultimap->equal_range(stdmultimap->begin()->first);
|
||||
|
||||
if( std::distance(bret.first, bret.second) !=
|
||||
std::distance(sret.first, sret.second) ){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
{
|
||||
IntType i1(i);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2011-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)
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,95 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/container/map.hpp>
|
||||
#include <boost/container/scoped_allocator.hpp>
|
||||
|
||||
template <typename Ty>
|
||||
class SimpleAllocator
|
||||
{
|
||||
public:
|
||||
typedef Ty value_type;
|
||||
typedef typename std::allocator<Ty>::pointer pointer;
|
||||
typedef typename std::allocator<Ty>::size_type size_type;
|
||||
|
||||
SimpleAllocator(int value)
|
||||
: _value(value)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
SimpleAllocator(const SimpleAllocator<T> &other)
|
||||
: _value(other._value)
|
||||
{}
|
||||
|
||||
pointer allocate(size_type n)
|
||||
{
|
||||
return _allocator.allocate(n);
|
||||
}
|
||||
void deallocate(pointer p, size_type n)
|
||||
{
|
||||
_allocator.deallocate(p, n);
|
||||
}
|
||||
private:
|
||||
int _value;
|
||||
std::allocator<Ty> _allocator;
|
||||
|
||||
template <typename T> friend class SimpleAllocator;
|
||||
};
|
||||
|
||||
template <typename Ty>
|
||||
class ScopedAllocator : public boost::container::scoped_allocator_adaptor<SimpleAllocator<Ty> >
|
||||
{
|
||||
private:
|
||||
typedef boost::container::scoped_allocator_adaptor<SimpleAllocator<Ty> > Base;
|
||||
|
||||
public:
|
||||
ScopedAllocator(int value)
|
||||
: Base(SimpleAllocator<Ty>(value))
|
||||
{}
|
||||
};
|
||||
|
||||
class Resource
|
||||
{
|
||||
private: // Not copyable
|
||||
Resource(const Resource &);
|
||||
Resource &operator=(const Resource &);
|
||||
public:
|
||||
typedef SimpleAllocator<int> allocator_type;
|
||||
|
||||
Resource(BOOST_RV_REF(Resource)other)
|
||||
: _value(other._value), _allocator(boost::move(other._allocator))
|
||||
{
|
||||
other._value = -1;
|
||||
}
|
||||
|
||||
Resource(BOOST_RV_REF(Resource)other, const allocator_type &allocator)
|
||||
: _value(other._value), _allocator(allocator)
|
||||
{
|
||||
other._value = -1;
|
||||
}
|
||||
|
||||
Resource(int value, const allocator_type &allocator)
|
||||
: _value(value), _allocator(allocator)
|
||||
{}
|
||||
private:
|
||||
int _value;
|
||||
allocator_type _allocator;
|
||||
};
|
||||
|
||||
typedef std::pair<const std::string, Resource> MapNode;
|
||||
|
||||
typedef boost::container::scoped_allocator_adaptor<SimpleAllocator<MapNode> > MapAllocator;
|
||||
|
||||
typedef boost::container::map<std::string, Resource, std::less<std::string>, MapAllocator> Map;
|
||||
|
||||
int main()
|
||||
{
|
||||
Map map1(std::less<std::string>(), SimpleAllocator<MapNode>(5));
|
||||
|
||||
map1.emplace("foo", 42);
|
||||
map1.emplace("bar", 11);
|
||||
|
||||
//Map map2 = map1;
|
||||
return 0;
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
@@ -201,8 +201,10 @@ void test_move()
|
||||
{
|
||||
//Now test move semantics
|
||||
C original;
|
||||
original.emplace();
|
||||
C move_ctor(boost::move(original));
|
||||
C move_assign;
|
||||
move_assign.emplace();
|
||||
move_assign = boost::move(move_ctor);
|
||||
move_assign.swap(original);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
|
||||
+23
-2
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
@@ -95,6 +95,26 @@ enum Test
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
const std::size_t positions_length = 10;
|
||||
std::size_t positions[positions_length];
|
||||
vector<int> vector_int;
|
||||
vector<int> vector_int2(positions_length);
|
||||
for(std::size_t i = 0; i != positions_length; ++i){
|
||||
positions[i] = 0u;
|
||||
}
|
||||
for(std::size_t i = 0, max = vector_int2.size(); i != max; ++i){
|
||||
vector_int2[i] = i;
|
||||
}
|
||||
|
||||
vector_int.insert(vector_int.begin(), 999);
|
||||
|
||||
vector_int.insert_ordered_at(positions_length, positions + positions_length, vector_int2.end());
|
||||
|
||||
for(std::size_t i = 0, max = vector_int.size(); i != max; ++i){
|
||||
std::cout << vector_int[i] << std::endl;
|
||||
}
|
||||
}
|
||||
recursive_vector_test();
|
||||
{
|
||||
//Now test move semantics
|
||||
@@ -134,7 +154,8 @@ int main()
|
||||
|
||||
if(!boost::container::test::test_propagate_allocator<vector>())
|
||||
return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2004-2011. Distributed under the Boost
|
||||
// (C) Copyright Ion Gaztanaga 2004-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)
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user