mirror of
https://github.com/boostorg/container.git
synced 2026-07-10 18:10:46 +02:00
Introducing allocator_traits and pointer_traits changes into several libraries.
[SVN r76107]
This commit is contained in:
+148
-9
@@ -16,6 +16,7 @@
|
||||
#include "dummy_test_allocator.hpp"
|
||||
#include "set_test.hpp"
|
||||
#include "map_test.hpp"
|
||||
#include "propagate_allocator_test.hpp"
|
||||
#include "emplace_test.hpp"
|
||||
|
||||
using namespace boost::container;
|
||||
@@ -49,10 +50,109 @@ typedef map<test::copyable_int
|
||||
,test::copyable_int> MyCopyBoostMap;
|
||||
typedef multimap<test::copyable_int
|
||||
,test::copyable_int> MyCopyBoostMultiMap;
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
|
||||
//Explicit instantiation to detect compilation errors
|
||||
|
||||
//map
|
||||
template class map
|
||||
< test::movable_and_copyable_int
|
||||
, test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, test::dummy_test_allocator
|
||||
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
|
||||
>;
|
||||
|
||||
template class map
|
||||
< test::movable_and_copyable_int
|
||||
, test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, test::simple_allocator
|
||||
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
|
||||
>;
|
||||
|
||||
template class map
|
||||
< test::movable_and_copyable_int
|
||||
, test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, std::allocator
|
||||
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
|
||||
>;
|
||||
|
||||
//multimap
|
||||
template class multimap
|
||||
< test::movable_and_copyable_int
|
||||
, test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, test::dummy_test_allocator
|
||||
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
|
||||
>;
|
||||
|
||||
template class multimap
|
||||
< test::movable_and_copyable_int
|
||||
, test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, test::simple_allocator
|
||||
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
|
||||
>;
|
||||
|
||||
template class multimap
|
||||
< test::movable_and_copyable_int
|
||||
, test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, std::allocator
|
||||
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
|
||||
>;
|
||||
|
||||
//set
|
||||
template class set
|
||||
< test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, test::dummy_test_allocator<test::movable_and_copyable_int>
|
||||
>;
|
||||
|
||||
template class set
|
||||
< test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, test::simple_allocator<test::movable_and_copyable_int>
|
||||
>;
|
||||
|
||||
template class set
|
||||
< test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, std::allocator<test::movable_and_copyable_int>
|
||||
>;
|
||||
|
||||
//multiset
|
||||
template class multiset
|
||||
< test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, test::dummy_test_allocator<test::movable_and_copyable_int>
|
||||
>;
|
||||
|
||||
template class multiset
|
||||
< test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, test::simple_allocator<test::movable_and_copyable_int>
|
||||
>;
|
||||
|
||||
template class multiset
|
||||
< test::movable_and_copyable_int
|
||||
, std::less<test::movable_and_copyable_int>
|
||||
, std::allocator<test::movable_and_copyable_int>
|
||||
>;
|
||||
|
||||
}} //boost::container
|
||||
|
||||
//Test recursive structures
|
||||
class recursive_set
|
||||
{
|
||||
public:
|
||||
recursive_set & operator=(const recursive_set &x)
|
||||
{ id_ = x.id_; set_ = x.set_; return *this; }
|
||||
|
||||
int id_;
|
||||
set<recursive_set> set_;
|
||||
friend bool operator< (const recursive_set &a, const recursive_set &b)
|
||||
@@ -62,6 +162,9 @@ public:
|
||||
class recursive_map
|
||||
{
|
||||
public:
|
||||
recursive_map & operator=(const recursive_map &x)
|
||||
{ id_ = x.id_; map_ = x.map_; return *this; }
|
||||
|
||||
int id_;
|
||||
map<recursive_map, recursive_map> map_;
|
||||
friend bool operator< (const recursive_map &a, const recursive_map &b)
|
||||
@@ -71,7 +174,10 @@ class recursive_map
|
||||
//Test recursive structures
|
||||
class recursive_multiset
|
||||
{
|
||||
public:
|
||||
public:
|
||||
recursive_multiset & operator=(const recursive_multiset &x)
|
||||
{ id_ = x.id_; multiset_ = x.multiset_; return *this; }
|
||||
|
||||
int id_;
|
||||
multiset<recursive_multiset> multiset_;
|
||||
friend bool operator< (const recursive_multiset &a, const recursive_multiset &b)
|
||||
@@ -80,7 +186,10 @@ public:
|
||||
|
||||
class recursive_multimap
|
||||
{
|
||||
public:
|
||||
public:
|
||||
recursive_multimap & operator=(const recursive_multimap &x)
|
||||
{ id_ = x.id_; multimap_ = x.multimap_; return *this; }
|
||||
|
||||
int id_;
|
||||
multimap<recursive_multimap, recursive_multimap> multimap_;
|
||||
friend bool operator< (const recursive_multimap &a, const recursive_multimap &b)
|
||||
@@ -98,6 +207,35 @@ void test_move()
|
||||
move_assign.swap(original);
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
class tree_propagate_test_wrapper
|
||||
: public container_detail::rbtree<T, T, container_detail::identity<T>, std::less<T>, A>
|
||||
{
|
||||
BOOST_COPYABLE_AND_MOVABLE(tree_propagate_test_wrapper)
|
||||
typedef container_detail::rbtree<T, T, container_detail::identity<T>, std::less<T>, A> Base;
|
||||
public:
|
||||
tree_propagate_test_wrapper()
|
||||
: Base()
|
||||
{}
|
||||
|
||||
tree_propagate_test_wrapper(const tree_propagate_test_wrapper &x)
|
||||
: Base(x)
|
||||
{}
|
||||
|
||||
tree_propagate_test_wrapper(BOOST_RV_REF(tree_propagate_test_wrapper) x)
|
||||
: Base(boost::move(static_cast<Base&>(x)))
|
||||
{}
|
||||
|
||||
tree_propagate_test_wrapper &operator=(BOOST_COPY_ASSIGN_REF(tree_propagate_test_wrapper) x)
|
||||
{ this->Base::operator=(x); return *this; }
|
||||
|
||||
tree_propagate_test_wrapper &operator=(BOOST_RV_REF(tree_propagate_test_wrapper) x)
|
||||
{ this->Base::operator=(boost::move(static_cast<Base&>(x))); return *this; }
|
||||
|
||||
void swap(tree_propagate_test_wrapper &x)
|
||||
{ this->Base::swap(x); }
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
//Recursive container instantiation
|
||||
@@ -180,13 +318,12 @@ int main ()
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if (0 != test::map_test<my_managed_shared_memory
|
||||
// ,MyMovableBoostMap
|
||||
// ,MyStdMap
|
||||
// ,MyMovableBoostMultiMap
|
||||
// ,MyStdMultiMap>()){
|
||||
// return 1;
|
||||
// }
|
||||
if (0 != test::map_test<MyMovableBoostMap
|
||||
,MyStdMap
|
||||
,MyMovableBoostMultiMap
|
||||
,MyStdMultiMap>()){
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (0 != test::map_test<MyMoveCopyBoostMap
|
||||
,MyStdMap
|
||||
@@ -226,6 +363,8 @@ int main ()
|
||||
return 1;
|
||||
if(!boost::container::test::test_emplace<multimap<test::EmplaceInt, test::EmplaceInt>, MapOptions>())
|
||||
return 1;
|
||||
if(!boost::container::test::test_propagate_allocator<tree_propagate_test_wrapper>())
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user