forked from boostorg/container
Experimental scoped_allocator support
[SVN r77481]
This commit is contained in:
@@ -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)
|
||||
//
|
||||
|
||||
+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
+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_at_ordered_positions(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;
|
||||
}
|
||||
return 0;
|
||||
/*
|
||||
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