mirror of
https://github.com/boostorg/container.git
synced 2025-08-02 22:14:26 +02:00
* Improved vector
's insertion performance.
* Changed again experimental multiallocation interface for better performance (still experimental). * Added no exception support for those willing to disable exceptions in their compilers. * Fixed GCC -Wshadow warnings. * Replaced deprecated BOOST_NO_XXXX with newer BOOST_NO_CXX11_XXX macros. [SVN r81519]
This commit is contained in:
@@ -614,6 +614,16 @@ use [*Boost.Container]? There are several reasons for that:
|
|||||||
|
|
||||||
[section:release_notes Release Notes]
|
[section:release_notes Release Notes]
|
||||||
|
|
||||||
|
[section:release_notes_boost_1_53_00 Boost 1.53 Release]
|
||||||
|
|
||||||
|
* Improved `vector`'s insertion performance.
|
||||||
|
* Changed again experimental multiallocation interface for better performance (still experimental).
|
||||||
|
* Added no exception support for those willing to disable exceptions in their compilers.
|
||||||
|
* Fixed GCC -Wshadow warnings.
|
||||||
|
* Replaced deprecated BOOST_NO_XXXX with newer BOOST_NO_CXX11_XXX macros.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
[section:release_notes_boost_1_52_00 Boost 1.52 Release]
|
[section:release_notes_boost_1_52_00 Boost 1.52 Release]
|
||||||
|
|
||||||
* Improved `stable_vector`'s template code bloat and type safety.
|
* Improved `stable_vector`'s template code bloat and type safety.
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include <boost/container/detail/workaround.hpp>
|
#include <boost/container/detail/workaround.hpp>
|
||||||
//[doc_move_containers
|
//[doc_move_containers
|
||||||
#include <boost/container/vector.hpp>
|
#include <boost/container/vector.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
//Non-copyable class
|
//Non-copyable class
|
||||||
|
@@ -5,6 +5,10 @@
|
|||||||
->Align with C++11 [multi]map::insert(P &&p) overload.
|
->Align with C++11 [multi]map::insert(P &&p) overload.
|
||||||
->Unify all allocator version traits in one class (starting from stable_vector_detail::allocator_version_wrapper)
|
->Unify all allocator version traits in one class (starting from stable_vector_detail::allocator_version_wrapper)
|
||||||
maybe in allocator_traits?
|
maybe in allocator_traits?
|
||||||
|
->Fix code marked with "//to-do: if possible, an efficient way to deallocate allocated blocks"
|
||||||
|
->Add BOOST_CONTAINER_TRY, etc. macros to allow disabling exceptions only in this library (just like Boost.Intrusive)
|
||||||
|
->Add macro to change the default allocator std::allocator to another one
|
||||||
|
->Add front()/back() to string
|
||||||
|
|
||||||
|
|
||||||
Review allocator traits
|
Review allocator traits
|
||||||
@@ -57,96 +61,3 @@ Add hash for containers
|
|||||||
Add std:: hashing support
|
Add std:: hashing support
|
||||||
|
|
||||||
Fix trivial destructor after move and other optimizing traits
|
Fix trivial destructor after move and other optimizing traits
|
||||||
|
|
||||||
Mark previous() in slist/and forward_list as non-standard
|
|
||||||
|
|
||||||
Function order:
|
|
||||||
|
|
||||||
----------type------------
|
|
||||||
value_type;
|
|
||||||
pointer;
|
|
||||||
const_pointer;
|
|
||||||
reference;
|
|
||||||
const_reference;
|
|
||||||
size_type;
|
|
||||||
difference_type;
|
|
||||||
allocator_type;
|
|
||||||
stored_allocator_type;
|
|
||||||
iterator;
|
|
||||||
const_iterator;
|
|
||||||
reverse_iterator;
|
|
||||||
const_reverse_iterator;
|
|
||||||
----------func------------
|
|
||||||
container()
|
|
||||||
container(allocator_type)
|
|
||||||
container(size_type)
|
|
||||||
container(size_type, value_type, allocator_type = ())
|
|
||||||
container(InpIt, InpIt)
|
|
||||||
container(const container &)
|
|
||||||
container(container &&)
|
|
||||||
container(const container &, allocator_type)
|
|
||||||
container(container &&, allocator_type)
|
|
||||||
container(initializer_list<T>, allocator)
|
|
||||||
~container()
|
|
||||||
container operator=(const container &)
|
|
||||||
container operator=(container &&)
|
|
||||||
container operator=(initializer_list<T>)
|
|
||||||
assign(size_type, const T &)
|
|
||||||
|
|
||||||
assign(InpIt, InptIt)
|
|
||||||
assign(initializer_list)
|
|
||||||
get_allocator()
|
|
||||||
|
|
||||||
begin()
|
|
||||||
begin() const
|
|
||||||
end()
|
|
||||||
end() const
|
|
||||||
rbegin()
|
|
||||||
rbegin() const
|
|
||||||
rend()
|
|
||||||
rend() const
|
|
||||||
|
|
||||||
cbegin() const
|
|
||||||
cend() const
|
|
||||||
crbegin() const
|
|
||||||
crend() const
|
|
||||||
|
|
||||||
empty()
|
|
||||||
size()
|
|
||||||
max_size()
|
|
||||||
resize(size_type)
|
|
||||||
resize(size_type, cont T&)
|
|
||||||
capacity()
|
|
||||||
reserve(size_type)
|
|
||||||
shrink_to_fit()
|
|
||||||
|
|
||||||
front()
|
|
||||||
front() const
|
|
||||||
back()
|
|
||||||
back() const
|
|
||||||
operator[] ()
|
|
||||||
operator[] ()const
|
|
||||||
at()
|
|
||||||
at() const
|
|
||||||
|
|
||||||
|
|
||||||
data()
|
|
||||||
data() const
|
|
||||||
|
|
||||||
emplace_front()
|
|
||||||
emplace_back()
|
|
||||||
emplace()
|
|
||||||
push_front(const T&)
|
|
||||||
push_front(T&&)
|
|
||||||
push_back(const T&)
|
|
||||||
push_back(T&&)
|
|
||||||
insert(iterator, const T &)
|
|
||||||
insert(iterator, T &&)
|
|
||||||
insert(size_type, const T &)
|
|
||||||
insert(InpIt, InpIt)
|
|
||||||
pop_front()
|
|
||||||
pop_back()
|
|
||||||
erase(const_iterator)
|
|
||||||
erase(const_iterator, const_iterator)
|
|
||||||
swap(container &)
|
|
||||||
clear()
|
|
@@ -242,6 +242,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\allocation_type.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\allocation_type.hpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\boost\container\detail\allocator_version_traits.hpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\boost\container\detail\config_begin.hpp">
|
RelativePath="..\..\..\..\boost\container\detail\config_begin.hpp">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
#include <boost/type_traits/integral_constant.hpp>
|
#include <boost/type_traits/integral_constant.hpp>
|
||||||
#include <boost/container/detail/function_detector.hpp>
|
#include <boost/container/detail/function_detector.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
@@ -21,7 +21,8 @@
|
|||||||
#include "check_equal_containers.hpp"
|
#include "check_equal_containers.hpp"
|
||||||
#include "dummy_test_allocator.hpp"
|
#include "dummy_test_allocator.hpp"
|
||||||
#include "movable_int.hpp"
|
#include "movable_int.hpp"
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
|
#include <boost/move/iterator.hpp>
|
||||||
#include <boost/container/detail/mpl.hpp>
|
#include <boost/container/detail/mpl.hpp>
|
||||||
#include <boost/container/detail/type_traits.hpp>
|
#include <boost/container/detail/type_traits.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -148,8 +149,7 @@ bool do_test()
|
|||||||
MyCntDeque *cntdeque = new MyCntDeque;
|
MyCntDeque *cntdeque = new MyCntDeque;
|
||||||
MyStdDeque *stddeque = new MyStdDeque;
|
MyStdDeque *stddeque = new MyStdDeque;
|
||||||
//Compare several shared memory deque operations with std::deque
|
//Compare several shared memory deque operations with std::deque
|
||||||
int i;
|
for(int i = 0; i < max*100; ++i){
|
||||||
for(i = 0; i < max*100; ++i){
|
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
cntdeque->insert(cntdeque->end(), boost::move(move_me));
|
cntdeque->insert(cntdeque->end(), boost::move(move_me));
|
||||||
stddeque->insert(stddeque->end(), i);
|
stddeque->insert(stddeque->end(), i);
|
||||||
@@ -159,7 +159,7 @@ bool do_test()
|
|||||||
cntdeque->clear();
|
cntdeque->clear();
|
||||||
stddeque->clear();
|
stddeque->clear();
|
||||||
|
|
||||||
for(i = 0; i < max*100; ++i){
|
for(int i = 0; i < max*100; ++i){
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
cntdeque->push_back(boost::move(move_me));
|
cntdeque->push_back(boost::move(move_me));
|
||||||
stddeque->push_back(i);
|
stddeque->push_back(i);
|
||||||
@@ -169,7 +169,7 @@ bool do_test()
|
|||||||
cntdeque->clear();
|
cntdeque->clear();
|
||||||
stddeque->clear();
|
stddeque->clear();
|
||||||
|
|
||||||
for(i = 0; i < max*100; ++i){
|
for(int i = 0; i < max*100; ++i){
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
cntdeque->push_front(boost::move(move_me));
|
cntdeque->push_front(boost::move(move_me));
|
||||||
stddeque->push_front(i);
|
stddeque->push_front(i);
|
||||||
@@ -239,7 +239,7 @@ bool do_test()
|
|||||||
|
|
||||||
if(!test::CheckEqualContainers(cntdeque, stddeque)) return false;
|
if(!test::CheckEqualContainers(cntdeque, stddeque)) return false;
|
||||||
|
|
||||||
for(i = 0; i < max; ++i){
|
for(int i = 0; i < max; ++i){
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
cntdeque->insert(cntdeque->begin(), boost::move(move_me));
|
cntdeque->insert(cntdeque->begin(), boost::move(move_me));
|
||||||
stddeque->insert(stddeque->begin(), i);
|
stddeque->insert(stddeque->begin(), i);
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include <boost/container/detail/mpl.hpp>
|
#include <boost/container/detail/mpl.hpp>
|
||||||
#include <boost/container/detail/version_type.hpp>
|
#include <boost/container/detail/version_type.hpp>
|
||||||
#include <boost/container/detail/multiallocation_chain.hpp>
|
#include <boost/container/detail/multiallocation_chain.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@@ -168,8 +168,8 @@ class dummy_test_allocator
|
|||||||
//!preferred_elements. The number of actually allocated elements is
|
//!preferred_elements. The number of actually allocated elements is
|
||||||
//!will be assigned to received_size. Memory allocated with this function
|
//!will be assigned to received_size. Memory allocated with this function
|
||||||
//!must be deallocated only with deallocate_one().
|
//!must be deallocated only with deallocate_one().
|
||||||
multiallocation_chain allocate_individual(size_type)
|
void allocate_individual(size_type, multiallocation_chain &)
|
||||||
{ return multiallocation_chain(); }
|
{}
|
||||||
|
|
||||||
//!Allocates many elements of size == 1 in a contiguous block
|
//!Allocates many elements of size == 1 in a contiguous block
|
||||||
//!of memory. The minimum number to be allocated is min_elements,
|
//!of memory. The minimum number to be allocated is min_elements,
|
||||||
@@ -177,7 +177,7 @@ class dummy_test_allocator
|
|||||||
//!preferred_elements. The number of actually allocated elements is
|
//!preferred_elements. The number of actually allocated elements is
|
||||||
//!will be assigned to received_size. Memory allocated with this function
|
//!will be assigned to received_size. Memory allocated with this function
|
||||||
//!must be deallocated only with deallocate_one().
|
//!must be deallocated only with deallocate_one().
|
||||||
void deallocate_individual(multiallocation_chain)
|
void deallocate_individual(multiallocation_chain &)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//!Allocates many elements of size elem_size in a contiguous block
|
//!Allocates many elements of size elem_size in a contiguous block
|
||||||
@@ -186,7 +186,7 @@ class dummy_test_allocator
|
|||||||
//!preferred_elements. The number of actually allocated elements is
|
//!preferred_elements. The number of actually allocated elements is
|
||||||
//!will be assigned to received_size. The elements must be deallocated
|
//!will be assigned to received_size. The elements must be deallocated
|
||||||
//!with deallocate(...)
|
//!with deallocate(...)
|
||||||
void deallocate_many(multiallocation_chain)
|
void deallocate_many(multiallocation_chain &)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
#include <boost/container/detail/config_begin.hpp>
|
#include <boost/container/detail/config_begin.hpp>
|
||||||
#include <boost/container/detail/workaround.hpp>
|
#include <boost/container/detail/workaround.hpp>
|
||||||
#include <boost/container/detail/mpl.hpp>
|
#include <boost/container/detail/mpl.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
#include <boost/container/detail/utilities.hpp>
|
#include <boost/container/detail/utilities.hpp>
|
||||||
#include <boost/aligned_storage.hpp>
|
#include <boost/aligned_storage.hpp>
|
||||||
|
|
||||||
@@ -98,14 +98,20 @@ enum EmplaceOptions{
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class Container>
|
template<class Container>
|
||||||
bool test_expected_container(const Container &ec, const EmplaceInt *Expected, unsigned int only_first_n)
|
bool test_expected_container(const Container &ec, const EmplaceInt *Expected, unsigned int only_first_n, unsigned int cont_offset = 0)
|
||||||
{
|
{
|
||||||
typedef typename Container::const_iterator const_iterator;
|
typedef typename Container::const_iterator const_iterator;
|
||||||
const_iterator itb(ec.begin()), ite(ec.end());
|
const_iterator itb(ec.begin()), ite(ec.end());
|
||||||
unsigned int cur = 0;
|
unsigned int cur = 0;
|
||||||
if(only_first_n > ec.size()){
|
if(cont_offset > ec.size()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(only_first_n > (ec.size() - cont_offset)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
while(cont_offset--){
|
||||||
|
++itb;
|
||||||
|
}
|
||||||
for(; itb != ite && only_first_n--; ++itb, ++cur){
|
for(; itb != ite && only_first_n--; ++itb, ++cur){
|
||||||
const EmplaceInt & cr = *itb;
|
const EmplaceInt & cr = *itb;
|
||||||
if(cr != Expected[cur]){
|
if(cr != Expected[cur]){
|
||||||
@@ -171,25 +177,31 @@ bool test_emplace_back(container_detail::true_)
|
|||||||
new(&expected [5]) EmplaceInt(1, 2, 3, 4, 5);
|
new(&expected [5]) EmplaceInt(1, 2, 3, 4, 5);
|
||||||
Container c;
|
Container c;
|
||||||
c.emplace_back();
|
c.emplace_back();
|
||||||
if(!test_expected_container(c, &expected[0], 1))
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
return false;
|
|
||||||
c.emplace_back(1);
|
|
||||||
if(!test_expected_container(c, &expected[0], 2))
|
|
||||||
return false;
|
|
||||||
c.emplace_back(1, 2);
|
|
||||||
if(!test_expected_container(c, &expected[0], 3))
|
|
||||||
return false;
|
|
||||||
c.emplace_back(1, 2, 3);
|
|
||||||
if(!test_expected_container(c, &expected[0], 4))
|
|
||||||
return false;
|
|
||||||
c.emplace_back(1, 2, 3, 4);
|
|
||||||
if(!test_expected_container(c, &expected[0], 5))
|
|
||||||
return false;
|
|
||||||
c.emplace_back(1, 2, 3, 4, 5);
|
|
||||||
if(!test_expected_container(c, &expected[0], 6))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
c.emplace_back(1);
|
||||||
|
if(!test_expected_container(c, &expected[0], 2)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
c.emplace_back(1, 2);
|
||||||
|
if(!test_expected_container(c, &expected[0], 3)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
c.emplace_back(1, 2, 3);
|
||||||
|
if(!test_expected_container(c, &expected[0], 4)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
c.emplace_back(1, 2, 3, 4);
|
||||||
|
if(!test_expected_container(c, &expected[0], 5)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
c.emplace_back(1, 2, 3, 4, 5);
|
||||||
|
if(!test_expected_container(c, &expected[0], 6)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << "...OK" << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,24 +224,31 @@ bool test_emplace_front(container_detail::true_)
|
|||||||
new(&expected [5]) EmplaceInt();
|
new(&expected [5]) EmplaceInt();
|
||||||
Container c;
|
Container c;
|
||||||
c.emplace_front();
|
c.emplace_front();
|
||||||
if(!test_expected_container(c, &expected[0] + 5, 1))
|
if(!test_expected_container(c, &expected[0] + 5, 1)){
|
||||||
return false;
|
return false;
|
||||||
c.emplace_front(1);/*
|
|
||||||
if(!test_expected_container(c, &expected[0] + 4, 2))
|
|
||||||
return false;
|
|
||||||
c.emplace_front(1, 2);
|
|
||||||
if(!test_expected_container(c, &expected[0] + 3, 3))
|
|
||||||
return false;
|
|
||||||
c.emplace_front(1, 2, 3);
|
|
||||||
if(!test_expected_container(c, &expected[0] + 2, 4))
|
|
||||||
return false;
|
|
||||||
c.emplace_front(1, 2, 3, 4);
|
|
||||||
if(!test_expected_container(c, &expected[0] + 1, 5))
|
|
||||||
return false;
|
|
||||||
c.emplace_front(1, 2, 3, 4, 5);
|
|
||||||
if(!test_expected_container(c, &expected[0] + 0, 6))
|
|
||||||
return false;*/
|
|
||||||
}
|
}
|
||||||
|
c.emplace_front(1);
|
||||||
|
if(!test_expected_container(c, &expected[0] + 4, 2)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
c.emplace_front(1, 2);
|
||||||
|
if(!test_expected_container(c, &expected[0] + 3, 3)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
c.emplace_front(1, 2, 3);
|
||||||
|
if(!test_expected_container(c, &expected[0] + 2, 4)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
c.emplace_front(1, 2, 3, 4);
|
||||||
|
if(!test_expected_container(c, &expected[0] + 1, 5)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
c.emplace_front(1, 2, 3, 4, 5);
|
||||||
|
if(!test_expected_container(c, &expected[0] + 0, 6)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << "...OK" << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,12 +269,14 @@ bool test_emplace_before(container_detail::true_)
|
|||||||
Container c;
|
Container c;
|
||||||
c.emplace(c.cend(), 1);
|
c.emplace(c.cend(), 1);
|
||||||
c.emplace(c.cbegin());
|
c.emplace(c.cbegin());
|
||||||
if(!test_expected_container(c, &expected[0], 2))
|
if(!test_expected_container(c, &expected[0], 2)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.emplace(c.cend());
|
c.emplace(c.cend());
|
||||||
if(!test_expected_container(c, &expected[0], 3))
|
if(!test_expected_container(c, &expected[0], 3)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
new(&expected [0]) EmplaceInt();
|
new(&expected [0]) EmplaceInt();
|
||||||
new(&expected [1]) EmplaceInt(1);
|
new(&expected [1]) EmplaceInt(1);
|
||||||
@@ -271,40 +292,75 @@ bool test_emplace_before(container_detail::true_)
|
|||||||
c.emplace(c.cbegin(), 1, 2);
|
c.emplace(c.cbegin(), 1, 2);
|
||||||
c.emplace(c.cbegin(), 1);
|
c.emplace(c.cbegin(), 1);
|
||||||
c.emplace(c.cbegin());
|
c.emplace(c.cbegin());
|
||||||
if(!test_expected_container(c, &expected[0], 6))
|
if(!test_expected_container(c, &expected[0], 6)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.clear();
|
c.clear();
|
||||||
//emplace_back-like
|
//emplace_back-like
|
||||||
typename Container::const_iterator i = c.emplace(c.cend());
|
typename Container::const_iterator i = c.emplace(c.cend());
|
||||||
if(!test_expected_container(c, &expected[0], 1))
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace(++i, 1);
|
i = c.emplace(++i, 1);
|
||||||
if(!test_expected_container(c, &expected[0], 2))
|
if(!test_expected_container(c, &expected[0], 2)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace(++i, 1, 2);
|
i = c.emplace(++i, 1, 2);
|
||||||
if(!test_expected_container(c, &expected[0], 3))
|
if(!test_expected_container(c, &expected[0], 3)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace(++i, 1, 2, 3);
|
i = c.emplace(++i, 1, 2, 3);
|
||||||
if(!test_expected_container(c, &expected[0], 4))
|
if(!test_expected_container(c, &expected[0], 4)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace(++i, 1, 2, 3, 4);
|
i = c.emplace(++i, 1, 2, 3, 4);
|
||||||
if(!test_expected_container(c, &expected[0], 5))
|
if(!test_expected_container(c, &expected[0], 5)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace(++i, 1, 2, 3, 4, 5);
|
i = c.emplace(++i, 1, 2, 3, 4, 5);
|
||||||
if(!test_expected_container(c, &expected[0], 6))
|
if(!test_expected_container(c, &expected[0], 6)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.clear();
|
c.clear();
|
||||||
//emplace in the middle
|
//emplace in the middle
|
||||||
c.emplace(c.cbegin());
|
c.emplace(c.cbegin());
|
||||||
i = c.emplace(c.cend(), 1, 2, 3, 4, 5);
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
i = c.emplace(i, 1, 2, 3, 4);
|
|
||||||
i = c.emplace(i, 1, 2, 3);
|
|
||||||
i = c.emplace(i, 1, 2);
|
|
||||||
i = c.emplace(i, 1);
|
|
||||||
|
|
||||||
if(!test_expected_container(c, &expected[0], 6))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
i = c.emplace(c.cend(), 1, 2, 3, 4, 5);
|
||||||
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!test_expected_container(c, &expected[5], 1, 1)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
i = c.emplace(i, 1, 2, 3, 4);
|
||||||
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!test_expected_container(c, &expected[4], 2, 1)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
i = c.emplace(i, 1, 2, 3);
|
||||||
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!test_expected_container(c, &expected[3], 3, 1)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
i = c.emplace(i, 1, 2);
|
||||||
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!test_expected_container(c, &expected[2], 4, 1)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
i = c.emplace(i, 1);
|
||||||
|
if(!test_expected_container(c, &expected[0], 6)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::cout << "...OK" << std::endl;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,12 +380,14 @@ bool test_emplace_after(container_detail::true_)
|
|||||||
Container c;
|
Container c;
|
||||||
typename Container::const_iterator i = c.emplace_after(c.cbefore_begin(), 1);
|
typename Container::const_iterator i = c.emplace_after(c.cbefore_begin(), 1);
|
||||||
c.emplace_after(c.cbefore_begin());
|
c.emplace_after(c.cbefore_begin());
|
||||||
if(!test_expected_container(c, &expected[0], 2))
|
if(!test_expected_container(c, &expected[0], 2)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.emplace_after(i);
|
c.emplace_after(i);
|
||||||
if(!test_expected_container(c, &expected[0], 3))
|
if(!test_expected_container(c, &expected[0], 3)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
new(&expected [0]) EmplaceInt();
|
new(&expected [0]) EmplaceInt();
|
||||||
new(&expected [1]) EmplaceInt(1);
|
new(&expected [1]) EmplaceInt(1);
|
||||||
@@ -345,28 +403,35 @@ bool test_emplace_after(container_detail::true_)
|
|||||||
c.emplace_after(c.cbefore_begin(), 1, 2);
|
c.emplace_after(c.cbefore_begin(), 1, 2);
|
||||||
c.emplace_after(c.cbefore_begin(), 1);
|
c.emplace_after(c.cbefore_begin(), 1);
|
||||||
c.emplace_after(c.cbefore_begin());
|
c.emplace_after(c.cbefore_begin());
|
||||||
if(!test_expected_container(c, &expected[0], 6))
|
if(!test_expected_container(c, &expected[0], 6)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.clear();
|
c.clear();
|
||||||
//emplace_back-like
|
//emplace_back-like
|
||||||
typename Container::const_iterator i = c.emplace_after(c.cbefore_begin());
|
typename Container::const_iterator i = c.emplace_after(c.cbefore_begin());
|
||||||
if(!test_expected_container(c, &expected[0], 1))
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace_after(i, 1);
|
i = c.emplace_after(i, 1);
|
||||||
if(!test_expected_container(c, &expected[0], 2))
|
if(!test_expected_container(c, &expected[0], 2)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace_after(i, 1, 2);
|
i = c.emplace_after(i, 1, 2);
|
||||||
if(!test_expected_container(c, &expected[0], 3))
|
if(!test_expected_container(c, &expected[0], 3)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace_after(i, 1, 2, 3);
|
i = c.emplace_after(i, 1, 2, 3);
|
||||||
if(!test_expected_container(c, &expected[0], 4))
|
if(!test_expected_container(c, &expected[0], 4)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace_after(i, 1, 2, 3, 4);
|
i = c.emplace_after(i, 1, 2, 3, 4);
|
||||||
if(!test_expected_container(c, &expected[0], 5))
|
if(!test_expected_container(c, &expected[0], 5)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
i = c.emplace_after(i, 1, 2, 3, 4, 5);
|
i = c.emplace_after(i, 1, 2, 3, 4, 5);
|
||||||
if(!test_expected_container(c, &expected[0], 6))
|
if(!test_expected_container(c, &expected[0], 6)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.clear();
|
c.clear();
|
||||||
//emplace_after in the middle
|
//emplace_after in the middle
|
||||||
i = c.emplace_after(c.cbefore_begin());
|
i = c.emplace_after(c.cbefore_begin());
|
||||||
@@ -376,9 +441,11 @@ bool test_emplace_after(container_detail::true_)
|
|||||||
c.emplace_after(i, 1, 2);
|
c.emplace_after(i, 1, 2);
|
||||||
c.emplace_after(i, 1);
|
c.emplace_after(i, 1);
|
||||||
|
|
||||||
if(!test_expected_container(c, &expected[0], 6))
|
if(!test_expected_container(c, &expected[0], 6)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
std::cout << "...OK" << std::endl;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,24 +468,31 @@ bool test_emplace_assoc(container_detail::true_)
|
|||||||
{
|
{
|
||||||
Container c;
|
Container c;
|
||||||
c.emplace();
|
c.emplace();
|
||||||
if(!test_expected_container(c, &expected[0], 1))
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.emplace(1);
|
c.emplace(1);
|
||||||
if(!test_expected_container(c, &expected[0], 2))
|
if(!test_expected_container(c, &expected[0], 2)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.emplace(1, 2);
|
c.emplace(1, 2);
|
||||||
if(!test_expected_container(c, &expected[0], 3))
|
if(!test_expected_container(c, &expected[0], 3)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.emplace(1, 2, 3);
|
c.emplace(1, 2, 3);
|
||||||
if(!test_expected_container(c, &expected[0], 4))
|
if(!test_expected_container(c, &expected[0], 4)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.emplace(1, 2, 3, 4);
|
c.emplace(1, 2, 3, 4);
|
||||||
if(!test_expected_container(c, &expected[0], 5))
|
if(!test_expected_container(c, &expected[0], 5)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
c.emplace(1, 2, 3, 4, 5);
|
c.emplace(1, 2, 3, 4, 5);
|
||||||
if(!test_expected_container(c, &expected[0], 6))
|
if(!test_expected_container(c, &expected[0], 6)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
std::cout << "...OK" << std::endl;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,24 +517,31 @@ bool test_emplace_hint(container_detail::true_)
|
|||||||
Container c;
|
Container c;
|
||||||
typename Container::const_iterator it;
|
typename Container::const_iterator it;
|
||||||
it = c.emplace_hint(c.begin());
|
it = c.emplace_hint(c.begin());
|
||||||
if(!test_expected_container(c, &expected[0], 1))
|
if(!test_expected_container(c, &expected[0], 1)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
it = c.emplace_hint(it, 1);
|
it = c.emplace_hint(it, 1);
|
||||||
if(!test_expected_container(c, &expected[0], 2))
|
if(!test_expected_container(c, &expected[0], 2)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
it = c.emplace_hint(it, 1, 2);
|
it = c.emplace_hint(it, 1, 2);
|
||||||
if(!test_expected_container(c, &expected[0], 3))
|
if(!test_expected_container(c, &expected[0], 3)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
it = c.emplace_hint(it, 1, 2, 3);
|
it = c.emplace_hint(it, 1, 2, 3);
|
||||||
if(!test_expected_container(c, &expected[0], 4))
|
if(!test_expected_container(c, &expected[0], 4)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
it = c.emplace_hint(it, 1, 2, 3, 4);
|
it = c.emplace_hint(it, 1, 2, 3, 4);
|
||||||
if(!test_expected_container(c, &expected[0], 5))
|
if(!test_expected_container(c, &expected[0], 5)){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
it = c.emplace_hint(it, 1, 2, 3, 4, 5);
|
it = c.emplace_hint(it, 1, 2, 3, 4, 5);
|
||||||
if(!test_expected_container(c, &expected[0], 6))
|
if(!test_expected_container(c, &expected[0], 6)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
std::cout << "...OK" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -498,6 +579,7 @@ bool test_emplace_assoc_pair(container_detail::true_)
|
|||||||
std::cout << "Error after c.emplace(2, 2);\n";
|
std::cout << "Error after c.emplace(2, 2);\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
std::cout << "...OK" << std::endl;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -536,6 +618,7 @@ bool test_emplace_hint_pair(container_detail::true_)
|
|||||||
std::cout << "Error after c.emplace(it, 2, 2);\n";
|
std::cout << "Error after c.emplace(it, 2, 2);\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
std::cout << "...OK" << std::endl;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -555,22 +638,30 @@ struct emplace_active
|
|||||||
template<class Container, EmplaceOptions O>
|
template<class Container, EmplaceOptions O>
|
||||||
bool test_emplace()
|
bool test_emplace()
|
||||||
{
|
{
|
||||||
if(!test_emplace_back<Container>(emplace_active<O, EMPLACE_BACK>()))
|
if(!test_emplace_back<Container>(emplace_active<O, EMPLACE_BACK>())){
|
||||||
return false;
|
return false;
|
||||||
if(!test_emplace_front<Container>(emplace_active<O, EMPLACE_FRONT>()))
|
}
|
||||||
|
if(!test_emplace_front<Container>(emplace_active<O, EMPLACE_FRONT>())){
|
||||||
return false;
|
return false;
|
||||||
if(!test_emplace_before<Container>(emplace_active<O, EMPLACE_BEFORE>()))
|
}
|
||||||
|
if(!test_emplace_before<Container>(emplace_active<O, EMPLACE_BEFORE>())){
|
||||||
return false;
|
return false;
|
||||||
if(!test_emplace_after<Container>(emplace_active<O, EMPLACE_AFTER>()))
|
}
|
||||||
|
if(!test_emplace_after<Container>(emplace_active<O, EMPLACE_AFTER>())){
|
||||||
return false;
|
return false;
|
||||||
if(!test_emplace_assoc<Container>(emplace_active<O, EMPLACE_ASSOC>()))
|
}
|
||||||
|
if(!test_emplace_assoc<Container>(emplace_active<O, EMPLACE_ASSOC>())){
|
||||||
return false;
|
return false;
|
||||||
if(!test_emplace_hint<Container>(emplace_active<O, EMPLACE_HINT>()))
|
}
|
||||||
|
if(!test_emplace_hint<Container>(emplace_active<O, EMPLACE_HINT>())){
|
||||||
return false;
|
return false;
|
||||||
if(!test_emplace_assoc_pair<Container>(emplace_active<O, EMPLACE_ASSOC_PAIR>()))
|
}
|
||||||
|
if(!test_emplace_assoc_pair<Container>(emplace_active<O, EMPLACE_ASSOC_PAIR>())){
|
||||||
return false;
|
return false;
|
||||||
if(!test_emplace_hint_pair<Container>(emplace_active<O, EMPLACE_HINT_PAIR>()))
|
}
|
||||||
|
if(!test_emplace_hint_pair<Container>(emplace_active<O, EMPLACE_HINT_PAIR>())){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -65,13 +65,16 @@ class expand_bwd_test_allocator
|
|||||||
|
|
||||||
typedef boost::container::container_detail::version_type<expand_bwd_test_allocator, 2> version;
|
typedef boost::container::container_detail::version_type<expand_bwd_test_allocator, 2> version;
|
||||||
|
|
||||||
|
//Dummy multiallocation chain
|
||||||
|
struct multiallocation_chain{};
|
||||||
|
|
||||||
template<class T2>
|
template<class T2>
|
||||||
struct rebind
|
struct rebind
|
||||||
{ typedef expand_bwd_test_allocator<T2> other; };
|
{ typedef expand_bwd_test_allocator<T2> other; };
|
||||||
|
|
||||||
//!Constructor from the segment manager. Never throws
|
//!Constructor from the segment manager. Never throws
|
||||||
expand_bwd_test_allocator(T *buffer, size_type size, difference_type offset)
|
expand_bwd_test_allocator(T *buffer, size_type sz, difference_type offset)
|
||||||
: mp_buffer(buffer), m_size(size)
|
: mp_buffer(buffer), m_size(sz)
|
||||||
, m_offset(offset), m_allocations(0){ }
|
, m_offset(offset), m_allocations(0){ }
|
||||||
|
|
||||||
//!Constructor from other expand_bwd_test_allocator. Never throws
|
//!Constructor from other expand_bwd_test_allocator. Never throws
|
||||||
|
@@ -627,3 +627,77 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include <boost/container/detail/config_end.hpp>
|
#include <boost/container/detail/config_end.hpp>
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <boost/container/map.hpp>
|
||||||
|
#include <boost/container/flat_map.hpp>
|
||||||
|
#include <boost/container/vector.hpp>
|
||||||
|
#include <boost/move/utility.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
struct Request
|
||||||
|
{
|
||||||
|
Request() {};
|
||||||
|
|
||||||
|
//Move semantics...
|
||||||
|
Request(BOOST_RV_REF(Request) r) : rvals() //Move constructor
|
||||||
|
{
|
||||||
|
rvals.swap(r.rvals);
|
||||||
|
};
|
||||||
|
|
||||||
|
Request& operator=(BOOST_RV_REF(Request) r) //Move assignment
|
||||||
|
{
|
||||||
|
if (this != &r){
|
||||||
|
rvals.swap(r.rvals);
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Values I want to be moved, not copied.
|
||||||
|
boost::container::vector<int> rvals;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Mark this class movable but not copyable
|
||||||
|
BOOST_MOVABLE_BUT_NOT_COPYABLE(Request)
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef boost::container::flat_map<int, Request> Requests;
|
||||||
|
//typedef boost::container::map<int, Request> Requests2;
|
||||||
|
|
||||||
|
int
|
||||||
|
main() {
|
||||||
|
Requests req;
|
||||||
|
std::pair<Requests::iterator, bool> ret = req.insert( Requests::value_type( 7, Request() ) );
|
||||||
|
std::cout << "Insert success for req: " << ret.second << std::endl;
|
||||||
|
|
||||||
|
//Requests2 req2;
|
||||||
|
//std::pair<Requests::iterator, bool> ret2 = req2.insert( Requests2::value_type( 7, Request() ) );
|
||||||
|
//std::cout << "Insert success for req2: " << ret2.second << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/container/flat_set.hpp>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(int , char *[])
|
||||||
|
{
|
||||||
|
double d[] = {0, 0.2, 0.8, 1, 2, 3, 4};
|
||||||
|
boost::container::flat_set<double> set;
|
||||||
|
|
||||||
|
set.insert(0);
|
||||||
|
set.insert(set.end(), 1);
|
||||||
|
set.insert(set.end(), 3);
|
||||||
|
set.insert(boost::container::ordered_unique_range_t(), d, d + sizeof(d)/sizeof(*d));
|
||||||
|
boost::container::flat_set<double>::iterator it(set.begin());
|
||||||
|
boost::container::flat_set<double>::iterator const itend(set.end());
|
||||||
|
while(it != itend)
|
||||||
|
cout << *it++ << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*/
|
@@ -19,7 +19,8 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include "print_container.hpp"
|
#include "print_container.hpp"
|
||||||
#include "input_from_forward_iterator.hpp"
|
#include "input_from_forward_iterator.hpp"
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
|
#include <boost/move/iterator.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
#include "print_container.hpp"
|
#include "print_container.hpp"
|
||||||
#include <boost/container/detail/utilities.hpp>
|
#include <boost/container/detail/utilities.hpp>
|
||||||
#include <boost/container/detail/pair.hpp>
|
#include <boost/container/detail/pair.hpp>
|
||||||
|
#include <boost/move/iterator.hpp>
|
||||||
|
#include <boost/move/utility.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
template<class T1, class T2, class T3, class T4>
|
template<class T1, class T2, class T3, class T4>
|
||||||
@@ -104,7 +106,6 @@ int map_test ()
|
|||||||
if(!CheckEqualContainers(boostmap2, stdmap2)) return 1;
|
if(!CheckEqualContainers(boostmap2, stdmap2)) return 1;
|
||||||
if(!CheckEqualContainers(boostmultimap2, stdmultimap2)) return 1;
|
if(!CheckEqualContainers(boostmultimap2, stdmultimap2)) return 1;
|
||||||
|
|
||||||
/*
|
|
||||||
MyBoostMap *boostmap3 = new MyBoostMap
|
MyBoostMap *boostmap3 = new MyBoostMap
|
||||||
( ordered_unique_range
|
( ordered_unique_range
|
||||||
, boost::make_move_iterator(&aux_vect[0])
|
, boost::make_move_iterator(&aux_vect[0])
|
||||||
@@ -124,12 +125,14 @@ int map_test ()
|
|||||||
std::cout << "Error in construct<MyBoostMultiMap>(MyBoostMultiMap3)" << std::endl;
|
std::cout << "Error in construct<MyBoostMultiMap>(MyBoostMultiMap3)" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
{
|
||||||
IntType i0(0);
|
IntType i0(0);
|
||||||
boostmap2->erase(i0);
|
boostmap2->erase(i0);
|
||||||
boostmultimap2->erase(i0);
|
boostmultimap2->erase(i0);
|
||||||
stdmap2->erase(0);
|
stdmap2->erase(0);
|
||||||
stdmultimap2->erase(0);
|
stdmultimap2->erase(0);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
IntType i0(0);
|
IntType i0(0);
|
||||||
IntType i1(1);
|
IntType i1(1);
|
||||||
@@ -146,10 +149,10 @@ int map_test ()
|
|||||||
delete boostmultimap2;
|
delete boostmultimap2;
|
||||||
delete stdmap2;
|
delete stdmap2;
|
||||||
delete stdmultimap2;
|
delete stdmultimap2;
|
||||||
//delete boostmap3;
|
delete boostmap3;
|
||||||
//delete boostmultimap3;
|
delete boostmultimap3;
|
||||||
//delete stdmap3;
|
delete stdmap3;
|
||||||
//delete stdmultimap3;
|
delete stdmultimap3;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
//This is really nasty, but we have no other simple choice
|
//This is really nasty, but we have no other simple choice
|
||||||
|
@@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
#include <boost/container/detail/config_begin.hpp>
|
#include <boost/container/detail/config_begin.hpp>
|
||||||
#include <boost/container/detail/workaround.hpp>
|
#include <boost/container/detail/workaround.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace container {
|
namespace container {
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include <boost/container/scoped_allocator_fwd.hpp>
|
#include <boost/container/scoped_allocator_fwd.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <boost/container/detail/mpl.hpp>
|
#include <boost/container/detail/mpl.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
#include <boost/type_traits/integral_constant.hpp>
|
#include <boost/type_traits/integral_constant.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#include <boost/container/detail/config_begin.hpp>
|
#include <boost/container/detail/config_begin.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
#include <boost/container/vector.hpp>
|
#include <boost/container/vector.hpp>
|
||||||
#include <boost/container/deque.hpp>
|
#include <boost/container/deque.hpp>
|
||||||
#include <boost/container/list.hpp>
|
#include <boost/container/list.hpp>
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "print_container.hpp"
|
#include "print_container.hpp"
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
|
#include <boost/move/iterator.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
@@ -119,8 +120,7 @@ int set_test ()
|
|||||||
delete stdmultiset3;
|
delete stdmultiset3;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i, j;
|
for(int i = 0; i < max; ++i){
|
||||||
for(i = 0; i < max; ++i){
|
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
boostset->insert(boost::move(move_me));
|
boostset->insert(boost::move(move_me));
|
||||||
stdset->insert(i);
|
stdset->insert(i);
|
||||||
@@ -301,7 +301,7 @@ int set_test ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < max; ++i){
|
for(int i = 0; i < max; ++i){
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
boostset->insert(boost::move(move_me));
|
boostset->insert(boost::move(move_me));
|
||||||
stdset->insert(i);
|
stdset->insert(i);
|
||||||
@@ -319,7 +319,8 @@ int set_test ()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < max; ++i){
|
for(int i = 0; i < max; ++i){
|
||||||
|
{
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
boostset->insert(boostset->begin(), boost::move(move_me));
|
boostset->insert(boostset->begin(), boost::move(move_me));
|
||||||
stdset->insert(stdset->begin(), i);
|
stdset->insert(stdset->begin(), i);
|
||||||
@@ -351,6 +352,7 @@ int set_test ()
|
|||||||
std::cout << "Error in boostmultiset->insert(boostmultiset->end(), boost::move(move_me4))" << std::endl;
|
std::cout << "Error in boostmultiset->insert(boostmultiset->end(), boost::move(move_me4))" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
boostset->insert(boostset->upper_bound(move_me), boost::move(move_me));
|
boostset->insert(boostset->upper_bound(move_me), boost::move(move_me));
|
||||||
@@ -372,10 +374,11 @@ int set_test ()
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
|
IntType move_me2(i);
|
||||||
boostset->insert(boostset->lower_bound(move_me), boost::move(move_me2));
|
boostset->insert(boostset->lower_bound(move_me), boost::move(move_me2));
|
||||||
stdset->insert(stdset->lower_bound(i), i);
|
stdset->insert(stdset->lower_bound(i), i);
|
||||||
//PrintContainers(boostset, stdset);
|
//PrintContainers(boostset, stdset);
|
||||||
IntType move_me2(i);
|
move_me2 = i;
|
||||||
boostmultiset->insert(boostmultiset->lower_bound(move_me2), boost::move(move_me2));
|
boostmultiset->insert(boostmultiset->lower_bound(move_me2), boost::move(move_me2));
|
||||||
stdmultiset->insert(stdmultiset->lower_bound(i), i);
|
stdmultiset->insert(stdmultiset->lower_bound(i), i);
|
||||||
//PrintContainers(boostmultiset, stdmultiset);
|
//PrintContainers(boostmultiset, stdmultiset);
|
||||||
@@ -391,7 +394,7 @@ int set_test ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Compare count with std containers
|
//Compare count with std containers
|
||||||
for(i = 0; i < max; ++i){
|
for(int i = 0; i < max; ++i){
|
||||||
IntType count_me(i);
|
IntType count_me(i);
|
||||||
if(boostset->count(count_me) != stdset->count(i)){
|
if(boostset->count(count_me) != stdset->count(i)){
|
||||||
return -1;
|
return -1;
|
||||||
@@ -407,8 +410,8 @@ int set_test ()
|
|||||||
boostset->clear();
|
boostset->clear();
|
||||||
boostmultiset->clear();
|
boostmultiset->clear();
|
||||||
|
|
||||||
for(j = 0; j < 3; ++j)
|
for(int j = 0; j < 3; ++j)
|
||||||
for(i = 0; i < 100; ++i){
|
for(int i = 0; i < 100; ++i){
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
boostset->insert(boost::move(move_me));
|
boostset->insert(boost::move(move_me));
|
||||||
IntType move_me2(i);
|
IntType move_me2(i);
|
||||||
@@ -448,8 +451,7 @@ int set_test_copyable ()
|
|||||||
MyBoostMultiSet *boostmultiset = new MyBoostMultiSet;
|
MyBoostMultiSet *boostmultiset = new MyBoostMultiSet;
|
||||||
MyStdMultiSet *stdmultiset = new MyStdMultiSet;
|
MyStdMultiSet *stdmultiset = new MyStdMultiSet;
|
||||||
|
|
||||||
int i;
|
for(int i = 0; i < max; ++i){
|
||||||
for(i = 0; i < max; ++i){
|
|
||||||
IntType move_me(i);
|
IntType move_me(i);
|
||||||
boostset->insert(boost::move(move_me));
|
boostset->insert(boost::move(move_me));
|
||||||
stdset->insert(i);
|
stdset->insert(i);
|
||||||
|
@@ -330,9 +330,6 @@ int string_test()
|
|||||||
|
|
||||||
//Check addition
|
//Check addition
|
||||||
{
|
{
|
||||||
typedef std::basic_string<CharType> StdString;
|
|
||||||
typedef basic_string<CharType> BoostString;
|
|
||||||
|
|
||||||
BoostString bs2 = string_literals<CharType>::String();
|
BoostString bs2 = string_literals<CharType>::String();
|
||||||
StdString ss2 = string_literals<CharType>::String();
|
StdString ss2 = string_literals<CharType>::String();
|
||||||
BoostString bs3 = string_literals<CharType>::Suffix();
|
BoostString bs3 = string_literals<CharType>::Suffix();
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <boost/container/vector.hpp>
|
#include <boost/container/vector.hpp>
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
#include "check_equal_containers.hpp"
|
#include "check_equal_containers.hpp"
|
||||||
#include "movable_int.hpp"
|
#include "movable_int.hpp"
|
||||||
#include "expand_bwd_test_allocator.hpp"
|
#include "expand_bwd_test_allocator.hpp"
|
||||||
@@ -148,12 +148,13 @@ int main()
|
|||||||
v.push_back(Test());
|
v.push_back(Test());
|
||||||
|
|
||||||
const test::EmplaceOptions Options = (test::EmplaceOptions)(test::EMPLACE_BACK | test::EMPLACE_BEFORE);
|
const test::EmplaceOptions Options = (test::EmplaceOptions)(test::EMPLACE_BACK | test::EMPLACE_BEFORE);
|
||||||
if(!boost::container::test::test_emplace
|
if(!boost::container::test::test_emplace< vector<test::EmplaceInt>, Options>()){
|
||||||
< vector<test::EmplaceInt>, Options>())
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if(!boost::container::test::test_propagate_allocator<vector>())
|
if(!boost::container::test::test_propagate_allocator<vector>()){
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include <boost/move/move.hpp>
|
#include <boost/move/utility.hpp>
|
||||||
#include <boost/container/detail/mpl.hpp>
|
#include <boost/container/detail/mpl.hpp>
|
||||||
#include "print_container.hpp"
|
#include "print_container.hpp"
|
||||||
#include "check_equal_containers.hpp"
|
#include "check_equal_containers.hpp"
|
||||||
@@ -28,6 +28,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "emplace_test.hpp"
|
#include "emplace_test.hpp"
|
||||||
#include "input_from_forward_iterator.hpp"
|
#include "input_from_forward_iterator.hpp"
|
||||||
|
#include <boost/move/utility.hpp>
|
||||||
|
#include <boost/move/iterator.hpp>
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
namespace container {
|
namespace container {
|
||||||
|
Reference in New Issue
Block a user