Trailing whitespaces

[SVN r78519]
This commit is contained in:
Ion Gaztañaga
2012-05-20 10:03:06 +00:00
parent 9460e03224
commit 082c47b721
27 changed files with 371 additions and 151 deletions

View File

@@ -1,14 +1,14 @@
# Boost Container Library Test Jamfile
# (C) Copyright Ion Gaztanaga 2009.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# 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)
# Adapted from John Maddock's TR1 Jamfile.v2
# Copyright John Maddock 2005.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# 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)
# this rule enumerates through all the sources and invokes
@@ -31,4 +31,4 @@ rule test_all
return $(all_rules) ;
}
test-suite container_test : [ test_all r ] ;
test-suite container_test : [ test_all r ] ;

View File

@@ -23,17 +23,17 @@ namespace test{
//Function to check if both containers are equal
template<class MyBoostCont
,class MyStdCont>
bool CheckEqualContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
bool CheckEqualContainers(const MyBoostCont *boostcont, const MyStdCont *stdcont)
{
if(boostcont->size() != stdcont->size())
return false;
typedef typename MyBoostCont::value_type value_type;
typename MyBoostCont::iterator itboost(boostcont->begin()), itboostend(boostcont->end());
typename MyStdCont::iterator itstd(stdcont->begin());
typename MyBoostCont::const_iterator itboost(boostcont->begin()), itboostend(boostcont->end());
typename MyStdCont::const_iterator itstd(stdcont->begin());
typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itboost, itboostend);
if(dist != boostcont->size()){
if(dist != boostcont->size()){
return false;
}
std::size_t i = 0;
@@ -48,7 +48,7 @@ bool CheckEqualContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
template<class MyBoostCont
,class MyStdCont>
bool CheckEqualPairContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
bool CheckEqualPairContainers(const MyBoostCont *boostcont, const MyStdCont *stdcont)
{
if(boostcont->size() != stdcont->size())
return false;
@@ -56,8 +56,8 @@ bool CheckEqualPairContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
typedef typename MyBoostCont::key_type key_type;
typedef typename MyBoostCont::mapped_type mapped_type;
typename MyBoostCont::iterator itboost(boostcont->begin()), itboostend(boostcont->end());
typename MyStdCont::iterator itstd(stdcont->begin());
typename MyBoostCont::const_iterator itboost(boostcont->begin()), itboostend(boostcont->end());
typename MyStdCont::const_iterator itstd(stdcont->begin());
for(; itboost != itboostend; ++itboost, ++itstd){
if(itboost->first != key_type(itstd->first))
return false;

View File

@@ -259,11 +259,11 @@ bool do_test()
cntdeque->resize(100);
stddeque->resize(100);
if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1;
if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1;
cntdeque->resize(200);
stddeque->resize(200);
if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1;
if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1;
delete cntdeque;
delete stddeque;
@@ -272,7 +272,7 @@ bool do_test()
std::cout << ex.what() << std::endl;
return false;
}
std::cout << std::endl << "Test OK!" << std::endl;
return true;
}

View File

@@ -69,7 +69,7 @@ class simple_allocator
//Version 2 allocator with rebind
template<class T>
class dummy_test_allocator
class dummy_test_allocator
{
private:
typedef dummy_test_allocator<T> self_t;
@@ -100,7 +100,7 @@ class dummy_test_allocator
//!Default constructor. Never throws
dummy_test_allocator()
{}
{}
//!Constructor from other dummy_test_allocator. Never throws
dummy_test_allocator(const dummy_test_allocator &)
@@ -111,7 +111,7 @@ class dummy_test_allocator
dummy_test_allocator(const dummy_test_allocator<T2> &)
{}
pointer address(reference value)
pointer address(reference value)
{ return pointer(container_detail::addressof(value)); }
const_pointer address(const_reference value) const
@@ -140,7 +140,7 @@ class dummy_test_allocator
std::pair<pointer, bool>
allocation_command(boost::container::allocation_type,
size_type,
size_type,
size_type,
size_type &, const pointer & = 0)
{ return std::pair<pointer, bool>(pointer(), true); }
@@ -192,19 +192,19 @@ class dummy_test_allocator
//!Equality test for same type of dummy_test_allocator
template<class T> inline
bool operator==(const dummy_test_allocator<T> &,
bool operator==(const dummy_test_allocator<T> &,
const dummy_test_allocator<T> &)
{ return true; }
//!Inequality test for same type of dummy_test_allocator
template<class T> inline
bool operator!=(const dummy_test_allocator<T> &,
bool operator!=(const dummy_test_allocator<T> &,
const dummy_test_allocator<T> &)
{ return false; }
template< class T
, bool PropagateOnContCopyAssign
, bool PropagateOnContCopyAssign
, bool PropagateOnContMoveAssign
, bool PropagateOnContSwap
, bool CopyOnPropagateOnContSwap
@@ -335,7 +335,7 @@ class propagation_test_allocator
};
template< class T
, bool PropagateOnContCopyAssign
, bool PropagateOnContCopyAssign
, bool PropagateOnContMoveAssign
, bool PropagateOnContSwap
, bool CopyOnPropagateOnContSwap

View File

@@ -36,11 +36,11 @@ namespace boost {
namespace container {
namespace test {
//This allocator just allows two allocations. The first one will return
//This allocator just allows two allocations. The first one will return
//mp_buffer + m_offset configured in the constructor. The second one
//will return mp_buffer.
template<class T>
class expand_bwd_test_allocator
class expand_bwd_test_allocator
{
private:
typedef expand_bwd_test_allocator<T> self_t;
@@ -70,12 +70,12 @@ class expand_bwd_test_allocator
{ typedef expand_bwd_test_allocator<T2> other; };
//!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 size, difference_type offset)
: mp_buffer(buffer), m_size(size)
, m_offset(offset), m_allocations(0){ }
//!Constructor from other expand_bwd_test_allocator. Never throws
expand_bwd_test_allocator(const expand_bwd_test_allocator &other)
expand_bwd_test_allocator(const expand_bwd_test_allocator &other)
: mp_buffer(other.mp_buffer), m_size(other.m_size)
, m_offset(other.m_offset), m_allocations(0){ }
@@ -108,7 +108,7 @@ class expand_bwd_test_allocator
{ return m_size; }
friend void swap(self_t &alloc1, self_t &alloc2)
{
{
container_detail::do_swap(alloc1.mp_buffer, alloc2.mp_buffer);
container_detail::do_swap(alloc1.m_size, alloc2.m_size);
container_detail::do_swap(alloc1.m_offset, alloc2.m_offset);
@@ -118,14 +118,14 @@ class expand_bwd_test_allocator
std::pair<pointer, bool>
allocation_command(boost::container::allocation_type command,
size_type limit_size,
size_type limit_size,
size_type preferred_size,
size_type &received_size, const pointer &reuse = 0)
{
(void)preferred_size; (void)reuse; (void)command;
//This allocator only expands backwards!
assert(m_allocations == 0 || (command & boost::container::expand_bwd));
received_size = limit_size;
if(m_allocations == 0){
@@ -173,13 +173,13 @@ class expand_bwd_test_allocator
//!Equality test for same type of expand_bwd_test_allocator
template<class T> inline
bool operator==(const expand_bwd_test_allocator<T> &alloc1,
bool operator==(const expand_bwd_test_allocator<T> &alloc1,
const expand_bwd_test_allocator<T> &alloc2)
{ return false; }
//!Inequality test for same type of expand_bwd_test_allocator
template<class T> inline
bool operator!=(const expand_bwd_test_allocator<T> &alloc1,
bool operator!=(const expand_bwd_test_allocator<T> &alloc1,
const expand_bwd_test_allocator<T> &alloc2)
{ return true; }

View File

@@ -114,19 +114,19 @@ bool test_insert_with_expand_bwd()
const int MemorySize = 1000;
//Distance old and new buffer
const int Offset[] =
const int Offset[] =
{ 350, 250, 150, 150,
150, 50, 50, 50 };
//Insert position
const int Position[] =
const int Position[] =
{ 100, 100, 100, 100,
100, 100, 100, 100 };
//Initial vector size
const int InitialSize[] =
const int InitialSize[] =
{ 200, 200, 200, 200,
200, 200, 200, 200 };
//Size of the data to insert
const int InsertSize[] =
const int InsertSize[] =
{ 100, 100, 100, 200,
300, 25, 100, 200 };
//Number of tests
@@ -159,7 +159,7 @@ bool test_insert_with_expand_bwd()
, data_to_insert.begin(), data_to_insert.end());
//Now check that values are equal
if(!CheckEqualVector(vector, initial_data)){
std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
<< " Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl
<< " Iteration: " << iteration << std::endl;
return false;
@@ -215,13 +215,13 @@ bool test_assign_with_expand_bwd()
vector.insert( vector.begin()
, initial_data.begin(), initial_data.end());
//Assign data
//Assign data
vector.assign(data_to_assign.begin(), data_to_assign.end());
initial_data.assign(data_to_assign.begin(), data_to_assign.end());
//Now check that values are equal
if(!CheckEqualVector(vector, initial_data)){
std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
<< " Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl
<< " Iteration: " << iteration << std::endl;
return false;

View File

@@ -19,12 +19,14 @@
#include "map_test.hpp"
#include "propagate_allocator_test.hpp"
#include "emplace_test.hpp"
#include <vector>
#include <boost/container/detail/flat_tree.hpp>
using namespace boost::container;
namespace boost {
namespace container {
/*
//Explicit instantiation to detect compilation errors
//flat_map
@@ -113,25 +115,25 @@ template class flat_multiset
, std::less<test::movable_and_copyable_int>
, std::allocator<test::movable_and_copyable_int>
>;
*/
}} //boost::container
//Alias allocator type
typedef std::allocator<int> allocator_t;
typedef std::allocator<test::movable_int>
typedef std::allocator<test::movable_int>
movable_allocator_t;
typedef std::allocator<std::pair<int, int> >
typedef std::allocator<std::pair<int, int> >
pair_allocator_t;
typedef std::allocator<std::pair<test::movable_int, test::movable_int> >
typedef std::allocator<std::pair<test::movable_int, test::movable_int> >
movable_pair_allocator_t;
typedef std::allocator<test::movable_and_copyable_int >
typedef std::allocator<test::movable_and_copyable_int >
move_copy_allocator_t;
typedef std::allocator<std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
typedef std::allocator<std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
move_copy_pair_allocator_t;
typedef std::allocator<test::copyable_int >
typedef std::allocator<test::copyable_int >
copy_allocator_t;
typedef std::allocator<std::pair<test::copyable_int, test::copyable_int> >
typedef std::allocator<std::pair<test::copyable_int, test::copyable_int> >
copy_pair_allocator_t;
@@ -302,6 +304,169 @@ class flat_tree_propagate_test_wrapper
{ this->Base::swap(x); }
};
namespace boost{
namespace container {
namespace test{
bool flat_tree_ordered_insertion_test()
{
using namespace boost::container;
const std::size_t NumElements = 100;
//Ordered insertion multiset
{
std::multiset<int> int_mset;
for(std::size_t i = 0; i != NumElements; ++i){
int_mset.insert(static_cast<int>(i));
}
//Construction insertion
flat_multiset<int> fmset(ordered_range, int_mset.begin(), int_mset.end());
if(!CheckEqualContainers(&int_mset, &fmset))
return false;
//Insertion when empty
fmset.clear();
fmset.insert(ordered_range, int_mset.begin(), int_mset.end());
if(!CheckEqualContainers(&int_mset, &fmset))
return false;
//Re-insertion
fmset.insert(ordered_range, int_mset.begin(), int_mset.end());
std::multiset<int> int_mset2(int_mset);
int_mset2.insert(int_mset.begin(), int_mset.end());
if(!CheckEqualContainers(&int_mset2, &fmset))
return false;
//Re-re-insertion
fmset.insert(ordered_range, int_mset2.begin(), int_mset2.end());
std::multiset<int> int_mset4(int_mset2);
int_mset4.insert(int_mset2.begin(), int_mset2.end());
if(!CheckEqualContainers(&int_mset4, &fmset))
return false;
//Re-re-insertion of even
std::multiset<int> int_even_mset;
for(std::size_t i = 0; i < NumElements; i+=2){
int_mset.insert(static_cast<int>(i));
}
fmset.insert(ordered_range, int_even_mset.begin(), int_even_mset.end());
int_mset4.insert(int_even_mset.begin(), int_even_mset.end());
if(!CheckEqualContainers(&int_mset4, &fmset))
return false;
}
//Ordered insertion multimap
{
std::multimap<int, int> int_mmap;
for(std::size_t i = 0; i != NumElements; ++i){
int_mmap.insert(std::multimap<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
//Construction insertion
flat_multimap<int, int> fmmap(ordered_range, int_mmap.begin(), int_mmap.end());
if(!CheckEqualContainers(&int_mmap, &fmmap))
return false;
//Insertion when empty
fmmap.clear();
fmmap.insert(ordered_range, int_mmap.begin(), int_mmap.end());
if(!CheckEqualContainers(&int_mmap, &fmmap))
return false;
//Re-insertion
fmmap.insert(ordered_range, int_mmap.begin(), int_mmap.end());
std::multimap<int, int> int_mmap2(int_mmap);
int_mmap2.insert(int_mmap.begin(), int_mmap.end());
if(!CheckEqualContainers(&int_mmap2, &fmmap))
return false;
//Re-re-insertion
fmmap.insert(ordered_range, int_mmap2.begin(), int_mmap2.end());
std::multimap<int, int> int_mmap4(int_mmap2);
int_mmap4.insert(int_mmap2.begin(), int_mmap2.end());
if(!CheckEqualContainers(&int_mmap4, &fmmap))
return false;
//Re-re-insertion of even
std::multimap<int, int> int_even_mmap;
for(std::size_t i = 0; i < NumElements; i+=2){
int_mmap.insert(std::multimap<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
fmmap.insert(ordered_range, int_even_mmap.begin(), int_even_mmap.end());
int_mmap4.insert(int_even_mmap.begin(), int_even_mmap.end());
if(!CheckEqualContainers(&int_mmap4, &fmmap))
return false;
}
//Ordered insertion set
{
std::set<int> int_set;
for(std::size_t i = 0; i != NumElements; ++i){
int_set.insert(static_cast<int>(i));
}
//Construction insertion
flat_set<int> fset(ordered_unique_range, int_set.begin(), int_set.end());
if(!CheckEqualContainers(&int_set, &fset))
return false;
//Insertion when empty
fset.clear();
fset.insert(ordered_unique_range, int_set.begin(), int_set.end());
if(!CheckEqualContainers(&int_set, &fset))
return false;
//Re-insertion
fset.insert(ordered_unique_range, int_set.begin(), int_set.end());
std::set<int> int_set2(int_set);
int_set2.insert(int_set.begin(), int_set.end());
if(!CheckEqualContainers(&int_set2, &fset))
return false;
//Re-re-insertion
fset.insert(ordered_unique_range, int_set2.begin(), int_set2.end());
std::set<int> int_set4(int_set2);
int_set4.insert(int_set2.begin(), int_set2.end());
if(!CheckEqualContainers(&int_set4, &fset))
return false;
//Re-re-insertion of even
std::set<int> int_even_set;
for(std::size_t i = 0; i < NumElements; i+=2){
int_set.insert(static_cast<int>(i));
}
fset.insert(ordered_unique_range, int_even_set.begin(), int_even_set.end());
int_set4.insert(int_even_set.begin(), int_even_set.end());
if(!CheckEqualContainers(&int_set4, &fset))
return false;
}
//Ordered insertion map
{
std::map<int, int> int_map;
for(std::size_t i = 0; i != NumElements; ++i){
int_map.insert(std::map<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
//Construction insertion
flat_map<int, int> fmap(ordered_unique_range, int_map.begin(), int_map.end());
if(!CheckEqualContainers(&int_map, &fmap))
return false;
//Insertion when empty
fmap.clear();
fmap.insert(ordered_unique_range, int_map.begin(), int_map.end());
if(!CheckEqualContainers(&int_map, &fmap))
return false;
//Re-insertion
fmap.insert(ordered_unique_range, int_map.begin(), int_map.end());
std::map<int, int> int_map2(int_map);
int_map2.insert(int_map.begin(), int_map.end());
if(!CheckEqualContainers(&int_map2, &fmap))
return false;
//Re-re-insertion
fmap.insert(ordered_unique_range, int_map2.begin(), int_map2.end());
std::map<int, int> int_map4(int_map2);
int_map4.insert(int_map2.begin(), int_map2.end());
if(!CheckEqualContainers(&int_map4, &fmap))
return false;
//Re-re-insertion of even
std::map<int, int> int_even_map;
for(std::size_t i = 0; i < NumElements; i+=2){
int_map.insert(std::map<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
fmap.insert(ordered_unique_range, int_even_map.begin(), int_even_map.end());
int_map4.insert(int_even_map.begin(), int_even_map.end());
if(!CheckEqualContainers(&int_map4, &fmap))
return false;
}
return true;
}
}}}
int main()
{
@@ -315,6 +480,9 @@ int main()
test_move<flat_multimap<recursive_flat_multimap, recursive_flat_multimap> >();
}
if(!flat_tree_ordered_insertion_test()){
return 1;
}
if (0 != set_test<
MyBoostSet
@@ -459,3 +627,55 @@ int main()
}
#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/move.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;
Requests::value_type v;
std::pair<Requests::iterator, bool> ret = req.insert( boost::move(v));
//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;
}
*/

View File

@@ -38,19 +38,19 @@ namespace boost {
namespace container {
namespace test {
//!An STL compatible heap_allocator_v1 that uses a segment manager as
//!An STL compatible heap_allocator_v1 that uses a segment manager as
//!memory source. The internal pointer type will of the same type (raw, smart) as
//!"typename SegmentManager::void_pointer" type. This allows
//!placing the heap_allocator_v1 in shared memory, memory mapped-files, etc...*/
template<class T, class SegmentManager>
class heap_allocator_v1
class heap_allocator_v1
{
private:
typedef heap_allocator_v1<T, SegmentManager> self_t;
typedef SegmentManager segment_manager;
typedef typename segment_manager::void_pointer aux_pointer_t;
typedef typename
typedef typename
boost::pointer_to_other
<aux_pointer_t, const void>::type cvoid_ptr;
@@ -80,7 +80,7 @@ class heap_allocator_v1
//!Obtains an heap_allocator_v1 of other type
template<class T2>
struct rebind
{
{
typedef heap_allocator_v1<T2, SegmentManager> other;
};
@@ -97,19 +97,19 @@ class heap_allocator_v1
{ return const_pointer(addressof(value)); }
*/
//!Constructor from the segment manager. Never throws
heap_allocator_v1(segment_manager *segment_mngr)
heap_allocator_v1(segment_manager *segment_mngr)
: mp_mngr(segment_mngr) { }
//!Constructor from other heap_allocator_v1. Never throws
heap_allocator_v1(const heap_allocator_v1 &other)
heap_allocator_v1(const heap_allocator_v1 &other)
: mp_mngr(other.get_segment_manager()){ }
//!Constructor from related heap_allocator_v1. Never throws
template<class T2>
heap_allocator_v1(const heap_allocator_v1<T2, SegmentManager> &other)
heap_allocator_v1(const heap_allocator_v1<T2, SegmentManager> &other)
: mp_mngr(other.get_segment_manager()){}
//!Allocates memory for an array of count elements.
//!Allocates memory for an array of count elements.
//!Throws boost::container::bad_alloc if there is no enough memory
pointer allocate(size_type count, cvoid_ptr hint = 0)
{ (void)hint; return ::new value_type[count]; }
@@ -118,7 +118,7 @@ class heap_allocator_v1
void deallocate(const pointer &ptr, size_type)
{ return ::delete[] detail::get_pointer(ptr) ; }
//!Construct object, calling constructor.
//!Construct object, calling constructor.
//!Throws if T(const T&) throws
void construct(const pointer &ptr, const_reference value)
{ new((void*)detail::get_pointer(ptr)) value_type(value); }
@@ -139,13 +139,13 @@ class heap_allocator_v1
//!Equality test for same type of heap_allocator_v1
template<class T, class SegmentManager> inline
bool operator==(const heap_allocator_v1<T , SegmentManager> &alloc1,
bool operator==(const heap_allocator_v1<T , SegmentManager> &alloc1,
const heap_allocator_v1<T, SegmentManager> &alloc2)
{ return alloc1.get_segment_manager() == alloc2.get_segment_manager(); }
//!Inequality test for same type of heap_allocator_v1
template<class T, class SegmentManager> inline
bool operator!=(const heap_allocator_v1<T, SegmentManager> &alloc1,
bool operator!=(const heap_allocator_v1<T, SegmentManager> &alloc1,
const heap_allocator_v1<T, SegmentManager> &alloc2)
{ return alloc1.get_segment_manager() != alloc2.get_segment_manager(); }

View File

@@ -23,13 +23,13 @@ namespace boost {
namespace container {
//Explicit instantiation to detect compilation errors
template class boost::container::list<test::movable_and_copyable_int,
template class boost::container::list<test::movable_and_copyable_int,
test::simple_allocator<test::movable_and_copyable_int> >;
template class boost::container::list<test::movable_and_copyable_int,
template class boost::container::list<test::movable_and_copyable_int,
test::dummy_test_allocator<test::movable_and_copyable_int> >;
template class boost::container::list<test::movable_and_copyable_int,
template class boost::container::list<test::movable_and_copyable_int,
std::allocator<test::movable_and_copyable_int> >;
}}

View File

@@ -258,7 +258,7 @@ int list_test (bool copied_allocators_equal = true)
boostlist->splice(boostlist->begin(), otherboostlist);
stdlist->splice(stdlist->begin(), otherstdlist);
if(!CheckEqualContainers(boostlist, stdlist))
return 1;
return 1;
}
listsize = (int)boostlist->size();

View File

@@ -48,7 +48,7 @@ int map_test ()
MyBoostMultiMap *boostmultimap = new MyBoostMultiMap;
MyStdMultiMap *stdmultimap = new MyStdMultiMap;
//Test construction from a range
//Test construction from a range
{
//This is really nasty, but we have no other simple choice
IntPairType aux_vect[50];
@@ -105,7 +105,7 @@ int map_test ()
if(!CheckEqualContainers(boostmultimap2, stdmultimap2)) return 1;
/*
MyBoostMap *boostmap3 = new MyBoostMap
MyBoostMap *boostmap3 = new MyBoostMap
( ordered_unique_range
, boost::make_move_iterator(&aux_vect[0])
, boost::make_move_iterator(aux_vect + 50));
@@ -393,7 +393,7 @@ int map_test ()
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;
@@ -523,7 +523,7 @@ int map_test_copyable ()
stdmapcopy = *stdmap;
boostmmapcopy = *boostmultimap;
stdmmapcopy = *stdmultimap;
if(!CheckEqualContainers(&boostmapcopy, &stdmapcopy))
return 1;
if(!CheckEqualContainers(&boostmmapcopy, &stdmmapcopy))

View File

@@ -77,8 +77,8 @@ class movable_int
int m_int;
};
template<class E, class T>
std::basic_ostream<E, T> & operator<<
template<class E, class T>
std::basic_ostream<E, T> & operator<<
(std::basic_ostream<E, T> & os, movable_int const & p)
{
@@ -109,7 +109,7 @@ class movable_and_copyable_int
movable_and_copyable_int(const movable_and_copyable_int& mmi)
: m_int(mmi.m_int)
{}
movable_and_copyable_int(BOOST_RV_REF(movable_and_copyable_int) mmi)
: m_int(mmi.m_int)
{ mmi.m_int = 0; }
@@ -148,8 +148,8 @@ class movable_and_copyable_int
int m_int;
};
template<class E, class T>
std::basic_ostream<E, T> & operator<<
template<class E, class T>
std::basic_ostream<E, T> & operator<<
(std::basic_ostream<E, T> & os, movable_and_copyable_int const & p)
{
@@ -177,7 +177,7 @@ class copyable_int
copyable_int(const copyable_int& mmi)
: m_int(mmi.m_int)
{}
copyable_int & operator= (int i)
{ this->m_int = i; return *this; }
@@ -206,8 +206,8 @@ class copyable_int
int m_int;
};
template<class E, class T>
std::basic_ostream<E, T> & operator<<
template<class E, class T>
std::basic_ostream<E, T> & operator<<
(std::basic_ostream<E, T> & os, copyable_int const & p)
{

View File

@@ -48,8 +48,8 @@ void PrintContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
for(; itboost != itboostend; ++itboost){
std::cout << *itboost << std::endl;
}
std::cout << "MyStdCont" << std::endl;
std::cout << "MyStdCont" << std::endl;
for(; itstd != itstdend; ++itstd){
std::cout << *itstd << std::endl;
}

View File

@@ -644,7 +644,7 @@ int main()
}
{
vector<int, scoped_allocator_adaptor< test_allocator<int, 0> > > dummy;
vector<int, scoped_allocator_adaptor< test_allocator<int, 0> > > dummy;
dummy.push_back(0);
}
@@ -682,15 +682,15 @@ int main()
BOOST_STATIC_ASSERT(( !boost::container::uses_allocator
< ::mark_on_scoped_allocation<NotUsesAllocator, 0>
, test_allocator<float, 0>
, test_allocator<float, 0>
>::value ));
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0>
, test_allocator<float, 0>
, test_allocator<float, 0>
>::value ));
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
< ::mark_on_scoped_allocation<ConstructibleSuffix, 0>
, test_allocator<float, 0>
, test_allocator<float, 0>
>::value ));
BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_prefix
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0> >::value ));

View File

@@ -240,7 +240,7 @@ struct container_wrapper
: public Container
{
typedef typename Container::allocator_type allocator_type;
container_wrapper(const allocator_type &a)
: Container(a)
{}

View File

@@ -40,7 +40,7 @@ int set_test ()
MyBoostMultiSet *boostmultiset = new MyBoostMultiSet;
MyStdMultiSet *stdmultiset = new MyStdMultiSet;
//Test construction from a range
//Test construction from a range
{
IntType aux_vect[50];
for(int i = 0; i < 50; ++i){
@@ -483,7 +483,7 @@ int set_test_copyable ()
boostmsetcopy = *boostmultiset;
stdmsetcopy = *stdmultiset;
if(!CheckEqualContainers(&boostmsetcopy, &stdmsetcopy))
return 1;
}

View File

@@ -22,13 +22,13 @@ namespace boost {
namespace container {
//Explicit instantiation to detect compilation errors
template class boost::container::slist<test::movable_and_copyable_int,
template class boost::container::slist<test::movable_and_copyable_int,
test::simple_allocator<test::movable_and_copyable_int> >;
template class boost::container::slist<test::movable_and_copyable_int,
template class boost::container::slist<test::movable_and_copyable_int,
test::dummy_test_allocator<test::movable_and_copyable_int> >;
template class boost::container::slist<test::movable_and_copyable_int,
template class boost::container::slist<test::movable_and_copyable_int,
std::allocator<test::movable_and_copyable_int> >;
}}

View File

@@ -30,13 +30,13 @@ namespace boost {
namespace container {
//Explicit instantiation to detect compilation errors
template class stable_vector<test::movable_and_copyable_int,
template class stable_vector<test::movable_and_copyable_int,
test::dummy_test_allocator<test::movable_and_copyable_int> >;
template class stable_vector<test::movable_and_copyable_int,
template class stable_vector<test::movable_and_copyable_int,
test::simple_allocator<test::movable_and_copyable_int> >;
template class stable_vector<test::movable_and_copyable_int,
template class stable_vector<test::movable_and_copyable_int,
std::allocator<test::movable_and_copyable_int> >;
}}

View File

@@ -26,10 +26,10 @@
using namespace boost::container;
typedef test::dummy_test_allocator<char> DummyCharAllocator;
typedef test::dummy_test_allocator<char> DummyCharAllocator;
typedef basic_string<char, std::char_traits<char>, DummyCharAllocator> DummyString;
typedef test::dummy_test_allocator<DummyString> DummyStringAllocator;
typedef test::dummy_test_allocator<wchar_t> DummyWCharAllocator;
typedef test::dummy_test_allocator<wchar_t> DummyWCharAllocator;
typedef basic_string<wchar_t, std::char_traits<wchar_t>, DummyWCharAllocator> DummyWString;
typedef test::dummy_test_allocator<DummyWString> DummyWStringAllocator;
@@ -67,7 +67,7 @@ template<class StrVector1, class StrVector2>
bool CheckEqualStringVector(StrVector1 *strvect1, StrVector2 *strvect2)
{
StringEqual comp;
return std::equal(strvect1->begin(), strvect1->end(),
return std::equal(strvect1->begin(), strvect1->end(),
strvect2->begin(), comp);
}
@@ -159,7 +159,7 @@ int string_test()
return 1;
}
//Now push back moving
//Now push back moving
for(int i = 0; i < MaxSize; ++i){
auxBoostString = string_literals<CharType>::String();
auxStdString = string_literals<CharType>::String();
@@ -189,7 +189,7 @@ int string_test()
return 1;
}
//Now push front moving
//Now push front moving
for(int i = 0; i < MaxSize; ++i){
auxBoostString = string_literals<CharType>::String();
auxStdString = string_literals<CharType>::String();
@@ -214,15 +214,15 @@ int string_test()
boost_swapper.swap(auxBoostString);
std_swapper.swap(auxStdString);
if(!StringEqual()(auxBoostString, auxStdString))
return 1;
return 1;
if(!StringEqual()(boost_swapper, std_swapper))
return 1;
return 1;
boost_swapper.swap(auxBoostString);
std_swapper.swap(auxStdString);
if(!StringEqual()(auxBoostString, auxStdString))
return 1;
return 1;
if(!StringEqual()(boost_swapper, std_swapper))
return 1;
return 1;
//Shrink_to_fit
auxBoostString.shrink_to_fit();
@@ -249,7 +249,7 @@ int string_test()
boost_swapper.swap(auxBoostString);
std_swapper.swap(auxStdString);
if(!StringEqual()(auxBoostString, auxStdString))
return 1;
return 1;
if(!StringEqual()(boost_swapper, std_swapper))
return 1;
boost_swapper.swap(auxBoostString);
@@ -280,9 +280,9 @@ int string_test()
for(int i = 0; i < MaxSize; ++i){
(*boostStringVect)[i].append(sufix);
(*stdStringVect)[i].append(sufix);
(*boostStringVect)[i].insert((*boostStringVect)[i].begin(),
(*boostStringVect)[i].insert((*boostStringVect)[i].begin(),
prefix, prefix + prefix_size);
(*stdStringVect)[i].insert((*stdStringVect)[i].begin(),
(*stdStringVect)[i].insert((*stdStringVect)[i].begin(),
prefix, prefix + prefix_size);
}
@@ -310,10 +310,10 @@ int string_test()
if(!CheckEqualStringVector(boostStringVect, stdStringVect)) return 1;
for(int i = 0; i < MaxSize; ++i){
(*boostStringVect)[i].replace((*boostStringVect)[i].begin(),
(*boostStringVect)[i].replace((*boostStringVect)[i].begin(),
(*boostStringVect)[i].end(),
string_literals<CharType>::String());
(*stdStringVect)[i].replace((*stdStringVect)[i].begin(),
(*stdStringVect)[i].replace((*stdStringVect)[i].begin(),
(*stdStringVect)[i].end(),
string_literals<CharType>::String());
}
@@ -330,7 +330,7 @@ int string_test()
{
typedef std::basic_string<CharType> StdString;
typedef basic_string<CharType> BoostString;
BoostString bs2 = string_literals<CharType>::String();
StdString ss2 = string_literals<CharType>::String();
BoostString bs3 = string_literals<CharType>::Suffix();

View File

@@ -30,13 +30,13 @@ namespace boost {
namespace container {
//Explicit instantiation to detect compilation errors
template class boost::container::vector<test::movable_and_copyable_int,
template class boost::container::vector<test::movable_and_copyable_int,
test::simple_allocator<test::movable_and_copyable_int> >;
template class boost::container::vector<test::movable_and_copyable_int,
template class boost::container::vector<test::movable_and_copyable_int,
test::dummy_test_allocator<test::movable_and_copyable_int> >;
template class boost::container::vector<test::movable_and_copyable_int,
template class boost::container::vector<test::movable_and_copyable_int,
std::allocator<test::movable_and_copyable_int> >;
}}

View File

@@ -90,15 +90,15 @@ int vector_test()
MyStdVector *stdvector = new MyStdVector;
boostvector->resize(100);
stdvector->resize(100);
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
boostvector->resize(200);
stdvector->resize(200);
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
boostvector->resize(0);
stdvector->resize(0);
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
for(int i = 0; i < max; ++i){
IntType new_int(i);