mirror of
https://github.com/boostorg/container.git
synced 2026-01-26 17:22:46 +01:00
Fixes #280 ("Several containers don't support non-movable types when move assigning")
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/container/slist.hpp>
|
||||
#include <boost/container/node_allocator.hpp>
|
||||
#include <boost/container/adaptive_pool.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include "dummy_test_allocator.hpp"
|
||||
@@ -54,6 +55,32 @@ struct GetAllocatorCont
|
||||
};
|
||||
};
|
||||
|
||||
template<class VoidAllocator>
|
||||
int test_cont_variants()
|
||||
{
|
||||
typedef typename GetAllocatorCont<VoidAllocator>::template apply<int>::type MyCont;
|
||||
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_int>::type MyMoveCont;
|
||||
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_and_copyable_int>::type MyCopyMoveCont;
|
||||
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::copyable_int>::type MyCopyCont;
|
||||
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::moveconstruct_int>::type MyMoveConstructCont;
|
||||
|
||||
if(test::list_test<MyCont, false>())
|
||||
return 1;
|
||||
|
||||
if(test::list_test<MyMoveCont, false>())
|
||||
return 1;
|
||||
if(test::list_test<MyCopyMoveCont, false>())
|
||||
return 1;
|
||||
if(test::list_test<MyCopyMoveCont, false>())
|
||||
return 1;
|
||||
if(test::list_test<MyCopyCont, false>())
|
||||
return 1;
|
||||
if (test::list_test<MyMoveConstructCont, false>())
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool test_support_for_initializer_list()
|
||||
{
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@@ -168,18 +195,18 @@ int main ()
|
||||
////////////////////////////////////
|
||||
// Testing allocator implementations
|
||||
////////////////////////////////////
|
||||
if (test::list_test<slist<int, std::allocator<int> >, false>())
|
||||
if (test_cont_variants< new_allocator<void> >()) {
|
||||
std::cerr << "test_cont_variants< std::allocator<void> > failed" << std::endl;
|
||||
return 1;
|
||||
if (test::list_test<slist<int>, false>())
|
||||
}
|
||||
if (test_cont_variants< std::allocator<void> >()) {
|
||||
std::cerr << "test_cont_variants< std::allocator<void> > failed" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if (test::list_test<slist<int, adaptive_pool<int> >, false>())
|
||||
return 1;
|
||||
if (test::list_test<slist<int, node_allocator<int> >, false>())
|
||||
return 1;
|
||||
if (test::list_test<slist<test::movable_int>, false>())
|
||||
return 1;
|
||||
if (test::list_test<slist<test::movable_and_copyable_int>, false>())
|
||||
return 1;
|
||||
if (test::list_test<slist<test::copyable_int>, false>())
|
||||
return 1;
|
||||
|
||||
////////////////////////////////////
|
||||
// Emplace testing
|
||||
|
||||
Reference in New Issue
Block a user