Massive dependency reduction. Removed dependency on several boost libraries and standard C++ headers.

This commit is contained in:
Ion Gaztañaga committed 2015-01-02 19:34:21 +01:00
1 parent 955248b739
commit 360957a797
97 files changed
+4315 -5030

No files matched your search

-1
View File
@@ -15,7 +15,6 @@
#include <vector>
#include <iostream>
#include <utility>
#include <cstring>
#include <algorithm> //std::remove
#include <boost/container/detail/alloc_lib_auto_link.hpp>
+77 -93
View File
@@ -11,18 +11,22 @@
#include <cstddef>
#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>
#include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/function_detector.hpp>
#include <boost/move/utility_core.hpp>
#include <memory>
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#include <boost/move/detail/fwd_macros.hpp>
#endif
#include <boost/core/lightweight_test.hpp>
template<class T>
class SimpleAllocator
{
public:
bool allocate_called_;
bool deallocate_called_;
public:
typedef T value_type;
template <class U>
@@ -73,6 +77,7 @@ class SimpleSmartPtr
template<class T>
class ComplexAllocator
{
public:
bool allocate_called_;
bool deallocate_called_;
bool allocate_hint_called_;
@@ -81,7 +86,6 @@ class ComplexAllocator
mutable bool select_on_container_copy_construction_called_;
bool construct_called_;
public:
typedef T value_type;
typedef SimpleSmartPtr<T> pointer;
typedef SimpleSmartPtr<const T> const_pointer;
@@ -93,9 +97,12 @@ class ComplexAllocator
typedef SimpleSmartPtr<const void> const_void_pointer;
typedef signed short difference_type;
typedef unsigned short size_type;
typedef boost::true_type propagate_on_container_copy_assignment;
typedef boost::true_type propagate_on_container_move_assignment;
typedef boost::true_type propagate_on_container_swap;
typedef boost::container::container_detail::
true_type propagate_on_container_copy_assignment;
typedef boost::container::container_detail::
true_type propagate_on_container_move_assignment;
typedef boost::container::container_detail::
true_type propagate_on_container_swap;
ComplexAllocator()
: allocate_called_(false)
@@ -127,23 +134,27 @@ class ComplexAllocator
size_type max_size() const
{ max_size_called_ = true; return size_type(size_type(0)-1); }
#define BOOST_PP_LOCAL_MACRO(n) \
template<class U BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
void construct(U *p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ \
construct_called_ = true; \
::new (p) U (BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
} \
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_CONTAINER_COMPLEXALLOCATOR_CONSTRUCT_IMPL(N)\
\
template< class U BOOST_MOVE_I##N BOOST_MOVE_CLASS##N > \
void construct(U *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N) \
{ construct_called_ = true; ::new(p) U ( BOOST_MOVE_FWD##N ); }\
//
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_COMPLEXALLOCATOR_CONSTRUCT_IMPL)
#undef BOOST_CONTAINER_COMPLEXALLOCATOR_CONSTRUCT_IMPL
#else
template< class U, class ...Args>
void construct(U *p, BOOST_FWD_REF(Args) ...args)
{ construct_called_ = true; ::new(p) U( ::boost::forward<Args>(args)...); }
#endif
template<class U>
void construct(U *p, boost::container::default_init_t)
{
construct_called_ = true;
::new (p) U;
}
{ construct_called_ = true; ::new(p)U; }
//getters
bool allocate_called() const
@@ -212,22 +223,23 @@ void test_void_allocator()
int main()
{
using namespace boost::container::container_detail;
test_void_allocator();
//SimpleAllocator
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< SimpleAllocator<int> >::value_type, int>::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< SimpleAllocator<int> >::pointer, int*>::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< SimpleAllocator<int> >::const_pointer, const int*>::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< SimpleAllocator<int> >::void_pointer, void*>::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< SimpleAllocator<int> >::const_void_pointer, const void*>::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< SimpleAllocator<int> >::difference_type, std::ptrdiff_t>::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< SimpleAllocator<int> >::size_type, std::size_t>::value ));
BOOST_STATIC_ASSERT(( boost::container::allocator_traits
< SimpleAllocator<int> >::propagate_on_container_copy_assignment::value == false ));
@@ -235,27 +247,27 @@ int main()
< SimpleAllocator<int> >::propagate_on_container_move_assignment::value == false ));
BOOST_STATIC_ASSERT(( boost::container::allocator_traits
< SimpleAllocator<int> >::propagate_on_container_swap::value == false ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< SimpleAllocator<int> >::rebind_traits<double>::allocator_type
, SimpleAllocator<double> >::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< SimpleAllocator<int> >::rebind_alloc<double>::value_type
, double >::value ));
//ComplexAllocator
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< ComplexAllocator<int> >::value_type, int>::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< ComplexAllocator<int> >::pointer, SimpleSmartPtr<int> >::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< ComplexAllocator<int> >::const_pointer, SimpleSmartPtr<const int> >::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< ComplexAllocator<int> >::void_pointer, SimpleSmartPtr<void> >::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< ComplexAllocator<int> >::const_void_pointer, SimpleSmartPtr<const void> >::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< ComplexAllocator<int> >::difference_type, signed short>::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< ComplexAllocator<int> >::size_type, unsigned short>::value ));
BOOST_STATIC_ASSERT(( boost::container::allocator_traits
< ComplexAllocator<int> >::propagate_on_container_copy_assignment::value == true ));
@@ -263,10 +275,10 @@ int main()
< ComplexAllocator<int> >::propagate_on_container_move_assignment::value == true ));
BOOST_STATIC_ASSERT(( boost::container::allocator_traits
< ComplexAllocator<int> >::propagate_on_container_swap::value == true ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< ComplexAllocator<int> >::rebind_traits<double>::allocator_type
, ComplexAllocator<double> >::value ));
BOOST_STATIC_ASSERT(( boost::is_same<boost::container::allocator_traits
BOOST_STATIC_ASSERT(( is_same<boost::container::allocator_traits
< ComplexAllocator<int> >::rebind_alloc<double>::value_type
, double >::value ));
@@ -279,51 +291,43 @@ int main()
//allocate
CAllocTraits::allocate(c_alloc, 1);
if(!c_alloc.allocate_called()){
return 1;
}
BOOST_TEST(c_alloc.allocate_called());
SAllocTraits::allocate(s_alloc, 1);
if(!s_alloc.allocate_called()){
return 1;
}
BOOST_TEST(s_alloc.allocate_called());
//deallocate
CAllocTraits::deallocate(c_alloc, CAllocTraits::pointer(), 1);
if(!c_alloc.deallocate_called()){
return 1;
}
BOOST_TEST(c_alloc.deallocate_called());
SAllocTraits::deallocate(s_alloc, SAllocTraits::pointer(), 1);
if(!s_alloc.deallocate_called()){
return 1;
}
BOOST_TEST(s_alloc.deallocate_called());
//allocate with hint
CAllocTraits::allocate(c_alloc, 1, CAllocTraits::const_void_pointer());
if(!c_alloc.allocate_hint_called()){
return 1;
}
BOOST_TEST(c_alloc.allocate_hint_called());
s_alloc.allocate_called_ = false;
SAllocTraits::allocate(s_alloc, 1, SAllocTraits::const_void_pointer());
BOOST_TEST(s_alloc.allocate_called());
//destroy
float dummy;
CAllocTraits::destroy(c_alloc, &dummy);
if(!c_alloc.destroy_called()){
return 1;
}
BOOST_TEST(c_alloc.destroy_called());
SAllocTraits::destroy(s_alloc, &dummy);
//max_size
CAllocTraits::max_size(c_alloc);
if(!c_alloc.max_size_called()){
return 1;
}
BOOST_TEST(c_alloc.max_size_called());
SAllocTraits::max_size(s_alloc);
//select_on_container_copy_construction
CAllocTraits::select_on_container_copy_construction(c_alloc);
if(!c_alloc.select_on_container_copy_construction_called()){
return 1;
}
BOOST_TEST(c_alloc.select_on_container_copy_construction_called());
SAllocTraits::select_on_container_copy_construction(s_alloc);
//construct
@@ -332,81 +336,61 @@ int main()
c.copymoveconstructed_ = true;
c.copymoveconstructed_ = true;
CAllocTraits::construct(c_alloc, &c);
if(!c_alloc.construct_called() || c.copymoveconstructed() || c.moved()){
return 1;
}
BOOST_TEST(c_alloc.construct_called() && !c.copymoveconstructed() && !c.moved());
}
{
int i = 5;
CAllocTraits::construct(c_alloc, &i, boost::container::default_init);
if(!c_alloc.construct_called() || i != 5){
return 1;
}
BOOST_TEST(c_alloc.construct_called() && i == 5);
}
{
copymovable c;
copymovable c2;
CAllocTraits::construct(c_alloc, &c, c2);
if(!c_alloc.construct_called() || !c.copymoveconstructed() || c.moved()){
return 1;
}
BOOST_TEST(c_alloc.construct_called() && c.copymoveconstructed() && !c.moved());
}
{
copymovable c;
copymovable c2;
CAllocTraits::construct(c_alloc, &c, ::boost::move(c2));
if(!c_alloc.construct_called() || !c.copymoveconstructed() || !c.moved()){
return 1;
}
BOOST_TEST(c_alloc.construct_called() && c.copymoveconstructed() && c.moved());
}
{
copymovable c;
c.copymoveconstructed_ = true;
c.copymoveconstructed_ = true;
SAllocTraits::construct(s_alloc, &c);
if(c.copymoveconstructed() || c.moved()){
return 1;
}
BOOST_TEST(!c.copymoveconstructed() && !c.moved());
}
{
int i = 4;
SAllocTraits::construct(s_alloc, &i, boost::container::default_init);
if(i != 4){
return 1;
}
BOOST_TEST(i == 4);
}
{
copymovable c;
copymovable c2;
SAllocTraits::construct(s_alloc, &c, c2);
if(!c.copymoveconstructed() || c.moved()){
return 1;
}
BOOST_TEST(c.copymoveconstructed() && !c.moved());
}
{
copymovable c;
copymovable c2;
SAllocTraits::construct(s_alloc, &c, ::boost::move(c2));
if(!c.copymoveconstructed() || !c.moved()){
return 1;
}
BOOST_TEST(c.copymoveconstructed() && c.moved());
}
{
copymovable c;
CAllocTraits::construct(c_alloc, &c, 0, 1, 2);
if(!c_alloc.construct_called() || c.copymoveconstructed() || c.moved()){
return 1;
}
BOOST_TEST(c_alloc.construct_called() && !c.copymoveconstructed() && !c.moved());
}
{
copymovable c;
copymovable c2;
SAllocTraits::construct(s_alloc, &c, 0, 1, 2);
if(c.copymoveconstructed() || c.moved()){
return 1;
}
BOOST_TEST(!c.copymoveconstructed() && !c.moved());
}
return 0;
return ::boost::report_errors();
}
#include <boost/container/detail/config_end.hpp>
+2 -2
View File
@@ -26,7 +26,7 @@ const Container &as_const(Container &c)
template<class Container>
bool test_nth_index_of(Container &c)
{
typename Container::iterator it;
typename Container::iterator it;
typename Container::const_iterator cit;
typename Container::size_type sz, csz;
//index 0
@@ -43,7 +43,7 @@ bool test_nth_index_of(Container &c)
return false;
if(csz != 0)
return false;
//index size()/2
const typename Container::size_type sz_div_2 = c.size()/2;
it = c.nth(sz_div_2);
+1 -21
View File
@@ -12,27 +12,7 @@
#define BOOST_CONTAINER_TEST_DEFAULT_INIT_TEST_HEADER
#include <boost/container/detail/config_begin.hpp>
#include <algorithm>
#include <memory>
#include <vector>
#include <iostream>
#include <functional>
#include <list>
#include <boost/move/utility_core.hpp>
#include <boost/container/detail/mpl.hpp>
#include "print_container.hpp"
#include "check_equal_containers.hpp"
#include "movable_int.hpp"
#include <string>
#include <vector>
#include "emplace_test.hpp"
#include "input_from_forward_iterator.hpp"
#include <boost/move/utility_core.hpp>
#include <boost/move/iterator.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/static_assert.hpp>
#include "insert_test.hpp"
#include <cstddef>
namespace boost{
namespace container {
-2
View File
@@ -9,11 +9,9 @@
//////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/config_begin.hpp>
#include <algorithm>
#include <memory>
#include <deque>
#include <iostream>
#include <functional>
#include <list>
#include <boost/container/deque.hpp>
+14 -14
View File
@@ -17,18 +17,22 @@
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/container/detail/allocation_type.hpp>
#include <boost/assert.hpp>
#include <boost/container/detail/utilities.hpp>
#include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/version_type.hpp>
#include <boost/container/detail/multiallocation_chain.hpp>
#include <boost/container/throw_exception.hpp>
#include <boost/container/detail/addressof.hpp>
#include <boost/container/detail/allocation_type.hpp>
#include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/multiallocation_chain.hpp>
#include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/version_type.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/move/adl_move_swap.hpp>
#include <boost/assert.hpp>
#include <memory>
#include <algorithm>
#include <cstddef>
@@ -136,12 +140,8 @@ class dummy_test_allocator
//Experimental version 2 dummy_test_allocator functions
std::pair<pointer, bool>
allocation_command(boost::container::allocation_type,
size_type,
size_type,
size_type &, const pointer & = 0)
{ return std::pair<pointer, bool>(pointer(), true); }
pointer allocation_command(boost::container::allocation_type, size_type, size_type &, pointer &p)
{ p = pointer(); return pointer(); }
//!Returns maximum the number of objects the previously allocated memory
//!pointed by p can hold.
+2 -3
View File
@@ -16,8 +16,7 @@
#include <boost/container/detail/workaround.hpp>
#include <boost/container/detail/mpl.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/container/detail/utilities.hpp>
#include <boost/aligned_storage.hpp>
#include <boost/container/detail/type_traits.hpp>
namespace boost{
namespace container {
@@ -147,7 +146,7 @@ bool test_expected_container(const Container &ec, const std::pair<EmplaceInt, Em
static EmplaceInt expected [10];
typedef std::pair<EmplaceInt, EmplaceInt> EmplaceIntPair;
static boost::aligned_storage<sizeof(EmplaceIntPair)*10>::type pair_storage;
static boost::container::container_detail::aligned_storage<sizeof(EmplaceIntPair)*10>::type pair_storage;
static EmplaceIntPair* initialize_emplace_int_pair()
{
+15 -13
View File
@@ -17,14 +17,18 @@
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/container/throw_exception.hpp>
#include <boost/container/detail/addressof.hpp>
#include <boost/container/detail/allocation_type.hpp>
#include <boost/assert.hpp>
#include <boost/container/detail/utilities.hpp>
#include <boost/container/detail/version_type.hpp>
#include <boost/move/adl_move_swap.hpp>
#include <boost/assert.hpp>
#include <memory>
#include <algorithm>
#include <cstddef>
@@ -117,35 +121,33 @@ class expand_bwd_test_allocator
//Experimental version 2 expand_bwd_test_allocator functions
std::pair<pointer, bool>
allocation_command(boost::container::allocation_type command,
size_type limit_size,
size_type preferred_size,
size_type &received_size, const pointer &reuse = 0)
pointer allocation_command(boost::container::allocation_type command,
size_type limit_size,size_type &prefer_in_recvd_out_size,pointer &reuse)
{
(void)preferred_size; (void)reuse; (void)command;
(void)reuse; (void)command;
//This allocator only expands backwards!
assert(m_allocations == 0 || (command & boost::container::expand_bwd));
received_size = limit_size;
prefer_in_recvd_out_size = limit_size;
if(m_allocations == 0){
if((m_offset + limit_size) > m_size){
assert(0);
}
++m_allocations;
return std::pair<pointer, bool>(mp_buffer + m_offset, false);
reuse = 0;
return (mp_buffer + m_offset);
}
else if(m_allocations == 1){
if(limit_size > m_size){
assert(0);
}
++m_allocations;
return std::pair<pointer, bool>(mp_buffer, true);
return mp_buffer;
}
else{
throw_bad_alloc();
return std::pair<pointer, bool>(mp_buffer, true);
return mp_buffer;
}
}
+5 -1
View File
@@ -18,7 +18,6 @@
#include "expand_bwd_test_allocator.hpp"
#include <boost/container/detail/algorithm.hpp> //equal()
#include "movable_int.hpp"
#include <boost/type_traits/remove_volatile.hpp>
#include <boost/move/make_unique.hpp>
namespace boost { namespace container { namespace test {
@@ -79,6 +78,9 @@ bool test_insert_with_expand_bwd()
{ 0, 100, 200 };
for(unsigned int pos = 0; pos < sizeof(Position)/sizeof(Position[0]); ++pos){
if(!life_count<value_type>::check(0))
return false;
for(unsigned int iteration = 0; iteration < Iterations; ++iteration)
{
boost::movelib::unique_ptr<char[]> memptr =
@@ -122,6 +124,8 @@ bool test_insert_with_expand_bwd()
return false;
}
}
if(!life_count<value_type>::check(0))
return false;
}
return true;
+6 -6
View File
@@ -183,7 +183,7 @@ public:
flat_multimap<recursive_flat_multimap, recursive_flat_multimap>::const_iterator cit_;
flat_multimap<recursive_flat_multimap, recursive_flat_multimap>::reverse_iterator rit_;
flat_multimap<recursive_flat_multimap, recursive_flat_multimap>::const_reverse_iterator crit_;
friend bool operator< (const recursive_flat_multimap &a, const recursive_flat_multimap &b)
{ return a.id_ < b.id_; }
};
@@ -199,17 +199,17 @@ void test_move()
move_assign.swap(original);
}
template<class T, class A>
template<class T, class Allocator>
class flat_map_propagate_test_wrapper
: public boost::container::flat_map
< T, T, std::less<T>
, typename boost::container::allocator_traits<A>::template
, typename boost::container::allocator_traits<Allocator>::template
portable_rebind_alloc< std::pair<T, T> >::type>
{
BOOST_COPYABLE_AND_MOVABLE(flat_map_propagate_test_wrapper)
typedef boost::container::flat_map
< T, T, std::less<T>
, typename boost::container::allocator_traits<A>::template
, typename boost::container::allocator_traits<Allocator>::template
portable_rebind_alloc< std::pair<T, T> >::type> Base;
public:
flat_map_propagate_test_wrapper()
@@ -441,8 +441,8 @@ int main()
//Allocator argument container
{
flat_map<int, int> map_((std::allocator<std::pair<int, int> >()));
flat_multimap<int, int> multimap_((std::allocator<std::pair<int, int> >()));
flat_map<int, int> map_((flat_map<int, int>::allocator_type()));
flat_multimap<int, int> multimap_((flat_multimap<int, int>::allocator_type()));
}
//Now test move semantics
{
+7 -7
View File
@@ -184,7 +184,7 @@ class recursive_flat_set
flat_set<recursive_flat_set>::const_iterator cit_;
flat_set<recursive_flat_set>::reverse_iterator rit_;
flat_set<recursive_flat_set>::const_reverse_iterator crit_;
friend bool operator< (const recursive_flat_set &a, const recursive_flat_set &b)
{ return a.id_ < b.id_; }
};
@@ -210,7 +210,7 @@ class recursive_flat_multiset
flat_multiset<recursive_flat_multiset>::const_iterator cit_;
flat_multiset<recursive_flat_multiset>::reverse_iterator rit_;
flat_multiset<recursive_flat_multiset>::const_reverse_iterator crit_;
friend bool operator< (const recursive_flat_multiset &a, const recursive_flat_multiset &b)
{ return a.id_ < b.id_; }
};
@@ -227,12 +227,12 @@ void test_move()
move_assign.swap(original);
}
template<class T, class A>
template<class T, class Allocator>
class flat_set_propagate_test_wrapper
: public boost::container::flat_set<T, std::less<T>, A>
: public boost::container::flat_set<T, std::less<T>, Allocator>
{
BOOST_COPYABLE_AND_MOVABLE(flat_set_propagate_test_wrapper)
typedef boost::container::flat_set<T, std::less<T>, A> Base;
typedef boost::container::flat_set<T, std::less<T>, Allocator> Base;
public:
flat_set_propagate_test_wrapper()
: Base()
@@ -524,8 +524,8 @@ int main()
//Allocator argument container
{
flat_set<int> set_((std::allocator<int>()));
flat_multiset<int> multiset_((std::allocator<int>()));
flat_set<int> set_((flat_set<int>::allocator_type()));
flat_multiset<int> multiset_((flat_multiset<int>::allocator_type()));
}
//Now test move semantics
{
+2 -2
View File
@@ -64,7 +64,7 @@ public:
X& operator=(BOOST_COPY_ASSIGN_REF(X) x)
{
i_ = x.i_;
p_ = x.p_;
// std::cout << "X& operator=(const X& x)\n";
@@ -82,7 +82,7 @@ public:
X& operator=(BOOST_RV_REF(X) x) BOOST_CONTAINER_NOEXCEPT
{
i_ = x.i_;
p_ = x.p_;
// std::cout << "X& operator=(X&& x)\n";
+11 -1
View File
@@ -71,7 +71,7 @@ public:
list<recursive_list>::const_iterator cit_;
list<recursive_list>::reverse_iterator rit_;
list<recursive_list>::const_reverse_iterator crit_;
recursive_list &operator=(const recursive_list &o)
{ list_ = o.list_; return *this; }
};
@@ -207,3 +207,13 @@ int main ()
}
#include <boost/container/detail/config_end.hpp>
/*
#include <boost/container/list.hpp>
//#include <list>
int main()
{
return 0;
}
*/
-3
View File
@@ -20,11 +20,8 @@
#include <boost/move/iterator.hpp>
#include <boost/move/make_unique.hpp>
#include <memory>
#include <list>
#include <vector>
#include <functional> //std::greater
#include <string>
namespace boost{
namespace container {
+7 -8
View File
@@ -13,7 +13,6 @@
#include <boost/container/node_allocator.hpp>
#include <boost/container/adaptive_pool.hpp>
#include <utility>
#include <map>
#include "print_container.hpp"
@@ -201,7 +200,7 @@ class recursive_map
map<recursive_map, recursive_map>::const_iterator cit_;
map<recursive_map, recursive_map>::reverse_iterator rit_;
map<recursive_map, recursive_map>::const_reverse_iterator crit_;
friend bool operator< (const recursive_map &a, const recursive_map &b)
{ return a.id_ < b.id_; }
};
@@ -218,7 +217,7 @@ class recursive_multimap
multimap<recursive_multimap, recursive_multimap>::const_iterator cit_;
multimap<recursive_multimap, recursive_multimap>::reverse_iterator rit_;
multimap<recursive_multimap, recursive_multimap>::const_reverse_iterator crit_;
friend bool operator< (const recursive_multimap &a, const recursive_multimap &b)
{ return a.id_ < b.id_; }
};
@@ -236,11 +235,11 @@ void test_move()
move_assign.swap(original);
}
template<class T, class A>
template<class T, class Allocator>
class map_propagate_test_wrapper
: public boost::container::map
< T, T, std::less<T>
, typename boost::container::allocator_traits<A>::template
, typename boost::container::allocator_traits<Allocator>::template
portable_rebind_alloc< std::pair<const T, T> >::type
//tree_assoc_defaults
>
@@ -248,7 +247,7 @@ class map_propagate_test_wrapper
BOOST_COPYABLE_AND_MOVABLE(map_propagate_test_wrapper)
typedef boost::container::map
< T, T, std::less<T>
, typename boost::container::allocator_traits<A>::template
, typename boost::container::allocator_traits<Allocator>::template
portable_rebind_alloc< std::pair<const T, T> >::type
> Base;
public:
@@ -399,8 +398,8 @@ int main ()
}
//Allocator argument container
{
map<int, int> map_((std::allocator<std::pair<const int, int> >()));
multimap<int, int> multimap_((std::allocator<std::pair<const int, int> >()));
map<int, int> map_((map<int, int>::allocator_type()));
multimap<int, int> multimap_((multimap<int, int>::allocator_type()));
}
//Now test move semantics
{
+10 -10
View File
@@ -14,22 +14,22 @@
#include <boost/container/detail/config_begin.hpp>
#include "check_equal_containers.hpp"
#include "print_container.hpp"
#include <boost/container/detail/utilities.hpp>
#include <boost/container/detail/pair.hpp>
#include <boost/move/iterator.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/move/make_unique.hpp>
#include <utility> //std::pair
#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
#include <string>
#include <iostream>
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME rebalance
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace test {
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
#include BOOST_PP_ITERATE()
#include <boost/intrusive/detail/mpl.hpp>
namespace boost { namespace container { namespace test {
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED(has_member_rebalance, rebalance)
}}}
template<class T1, class T2, class T3, class T4>
bool operator ==(std::pair<T1, T2> &p1, std::pair<T1, T2> &p2)
@@ -534,13 +534,13 @@ int map_test()
return 1;
map_test_rebalanceable(boostmap
, container_detail::bool_<has_member_function_callable_with_rebalance<MyBoostMap>::value>());
, container_detail::bool_<has_member_rebalance<MyBoostMap>::value>());
if(!CheckEqualContainers(boostmap, stdmap)){
std::cout << "Error in boostmap.rebalance()" << std::endl;
return 1;
}
map_test_rebalanceable(boostmultimap
, container_detail::bool_<has_member_function_callable_with_rebalance<MyBoostMultiMap>::value>());
, container_detail::bool_<has_member_rebalance<MyBoostMap>::value>());
if(!CheckEqualContainers(boostmultimap, stdmultimap)){
std::cout << "Error in boostmultimap.rebalance()" << std::endl;
return 1;
+1 -2
View File
@@ -22,14 +22,13 @@
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/aligned_storage.hpp>
#include <boost/static_assert.hpp>
#include <cstring>
#include <new>
using namespace boost::container;
typedef boost::aligned_storage<sizeof(void*)*4>::type buffer_t;
typedef boost::container::container_detail::aligned_storage<sizeof(void*)*4>::type buffer_t;
static buffer_t buffer_0x00;
static buffer_t buffer_0xFF;
-21
View File
@@ -12,33 +12,12 @@
#define BOOST_PRINTCONTAINER_HPP
#include <boost/container/detail/config_begin.hpp>
#include <functional>
#include <iostream>
#include <algorithm>
namespace boost{
namespace container {
namespace test{
struct PrintValues
{
typedef int argument_type;
typedef void result_type;
void operator() (int value) const
{
std::cout << value << " ";
}
};
template<class Container>
void PrintContents(const Container &cont, const char *contName)
{
std::cout<< "Printing contents of " << contName << std::endl;
std::for_each(cont.begin(), cont.end(), PrintValues());
std::cout<< std::endl << std::endl;
}
//Function to dump data
template<class MyBoostCont
,class MyStdCont>
+6 -6
View File
@@ -9,7 +9,6 @@
//////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/scoped_allocator_fwd.hpp>
#include <boost/container/detail/utilities.hpp>
#include <cstddef>
#include <boost/container/detail/mpl.hpp>
#include <boost/move/utility_core.hpp>
@@ -237,21 +236,22 @@ namespace container {
template<unsigned int AllocatorTag>
struct constructible_with_allocator_prefix
< ::mark_on_scoped_allocation<ConstructiblePrefix, AllocatorTag> >
: ::boost::true_type
{};
{
static const bool value = true;
};
template<unsigned int AllocatorTag>
struct constructible_with_allocator_suffix
< ::mark_on_scoped_allocation<ConstructibleSuffix, AllocatorTag> >
: ::boost::true_type
{};
{
static const bool value = true;
};
} //namespace container {
} //namespace boost {
#include <boost/container/scoped_allocator.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
#include <boost/container/vector.hpp>
#include <boost/container/detail/pair.hpp>
+33 -24
View File
@@ -1,3 +1,12 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2011-2013. 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)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/config_begin.hpp>
#include <memory>
@@ -136,26 +145,26 @@ struct is_unique_assoc
static const bool value = false;
};
template<class K, class V, class C, class A>
struct is_unique_assoc< map<K, V, C, A> >
template<class Key, class T, class Compare, class Allocator>
struct is_unique_assoc< map<Key, T, Compare, Allocator> >
{
static const bool value = true;
};
template<class K, class V, class C, class A>
struct is_unique_assoc< flat_map<K, V, C, A> >
template<class Key, class T, class Compare, class Allocator>
struct is_unique_assoc< flat_map<Key, T, Compare, Allocator> >
{
static const bool value = true;
};
template<class V, class C, class A>
struct is_unique_assoc< set<V, C, A> >
template<class Key, class Compare, class Allocator>
struct is_unique_assoc< set<Key, Compare, Allocator> >
{
static const bool value = true;
};
template<class V, class C, class A>
struct is_unique_assoc< flat_set<V, C, A> >
template<class Key, class Compare, class Allocator>
struct is_unique_assoc< flat_set<Key, Compare, Allocator> >
{
static const bool value = true;
};
@@ -171,26 +180,26 @@ struct is_map
static const bool value = false;
};
template<class K, class V, class C, class A>
struct is_map< map<K, V, C, A> >
template<class Key, class T, class Compare, class Allocator>
struct is_map< map<Key, T, Compare, Allocator> >
{
static const bool value = true;
};
template<class K, class V, class C, class A>
struct is_map< flat_map<K, V, C, A> >
template<class Key, class T, class Compare, class Allocator>
struct is_map< flat_map<Key, T, Compare, Allocator> >
{
static const bool value = true;
};
template<class K, class V, class C, class A>
struct is_map< multimap<K, V, C, A> >
template<class Key, class T, class Compare, class Allocator>
struct is_map< multimap<Key, T, Compare, Allocator> >
{
static const bool value = true;
};
template<class K, class V, class C, class A>
struct is_map< flat_multimap<K, V, C, A> >
template<class Key, class T, class Compare, class Allocator>
struct is_map< flat_multimap<Key, T, Compare, Allocator> >
{
static const bool value = true;
};
@@ -201,26 +210,26 @@ struct is_set
static const bool value = false;
};
template<class V, class C, class A>
struct is_set< set<V, C, A> >
template<class Key, class Compare, class Allocator>
struct is_set< set<Key, Compare, Allocator> >
{
static const bool value = true;
};
template<class V, class C, class A>
struct is_set< flat_set<V, C, A> >
template<class Key, class Compare, class Allocator>
struct is_set< flat_set<Key, Compare, Allocator> >
{
static const bool value = true;
};
template<class V, class C, class A>
struct is_set< multiset<V, C, A> >
template<class Key, class Compare, class Allocator>
struct is_set< multiset<Key, Compare, Allocator> >
{
static const bool value = true;
};
template<class V, class C, class A>
struct is_set< flat_multiset<V, C, A> >
template<class Key, class Compare, class Allocator>
struct is_set< flat_multiset<Key, Compare, Allocator> >
{
static const bool value = true;
};
+7 -7
View File
@@ -176,7 +176,7 @@ public:
set<recursive_set>::const_iterator cit_;
set<recursive_set>::reverse_iterator rit_;
set<recursive_set>::const_reverse_iterator crit_;
friend bool operator< (const recursive_set &a, const recursive_set &b)
{ return a.id_ < b.id_; }
};
@@ -194,7 +194,7 @@ class recursive_multiset
multiset<recursive_multiset>::const_iterator cit_;
multiset<recursive_multiset>::reverse_iterator rit_;
multiset<recursive_multiset>::const_reverse_iterator crit_;
friend bool operator< (const recursive_multiset &a, const recursive_multiset &b)
{ return a.id_ < b.id_; }
};
@@ -212,14 +212,14 @@ void test_move()
move_assign.swap(original);
}
template<class T, class A>
template<class T, class Allocator>
class set_propagate_test_wrapper
: public boost::container::set<T, std::less<T>, A
: public boost::container::set<T, std::less<T>, Allocator
//tree_assoc_defaults
>
{
BOOST_COPYABLE_AND_MOVABLE(set_propagate_test_wrapper)
typedef boost::container::set<T, std::less<T>, A > Base;
typedef boost::container::set<T, std::less<T>, Allocator > Base;
public:
set_propagate_test_wrapper()
: Base()
@@ -363,8 +363,8 @@ int main ()
}
//Allocator argument container
{
set<int> set_((std::allocator<int>()));
multiset<int> multiset_((std::allocator<int>()));
set<int> set_((set<int>::allocator_type()));
multiset<int> multiset_((multiset<int>::allocator_type()));
}
//Now test move semantics
{
+4 -9
View File
@@ -13,22 +13,17 @@
#include <boost/container/detail/config_begin.hpp>
#include "check_equal_containers.hpp"
#include <memory>
#include <set>
#include <functional>
#include "print_container.hpp"
#include <boost/move/utility_core.hpp>
#include <boost/move/iterator.hpp>
#include <boost/move/make_unique.hpp>
#include <string>
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME rebalance
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace test {
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace test {
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
#include BOOST_PP_ITERATE()
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
namespace boost{
namespace container {
+1 -1
View File
@@ -59,7 +59,7 @@ public:
slist<recursive_slist> slist_;
slist<recursive_slist>::iterator it_;
slist<recursive_slist>::const_iterator cit_;
recursive_slist &operator=(const recursive_slist &o)
{ slist_ = o.slist_; return *this; }
};
+1 -5
View File
@@ -9,11 +9,7 @@
//////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/config_begin.hpp>
#include <algorithm>
#include <memory>
#include <vector>
#include <iostream>
#include <functional>
#include <boost/container/stable_vector.hpp>
#include <boost/container/allocator.hpp>
@@ -70,7 +66,7 @@ class recursive_vector
stable_vector<recursive_vector>::const_iterator cit_;
stable_vector<recursive_vector>::reverse_iterator rit_;
stable_vector<recursive_vector>::const_reverse_iterator crit_;
recursive_vector &operator=(const recursive_vector &o)
{ vector_ = o.vector_; return *this; }
};
+3
View File
@@ -78,6 +78,9 @@ private:
namespace boost {
template <class T>
struct has_nothrow_move;
template <>
struct has_nothrow_move<counting_value>
{
+3 -3
View File
@@ -432,12 +432,12 @@ bool test_expand_bwd()
return test::test_all_expand_bwd<string_type>();
}
template<class T, class A>
template<class T, class Allocator>
class string_propagate_test_wrapper
: public basic_string<T, std::char_traits<T>, A>
: public basic_string<T, std::char_traits<T>, Allocator>
{
BOOST_COPYABLE_AND_MOVABLE(string_propagate_test_wrapper)
typedef basic_string<T, std::char_traits<T>, A> Base;
typedef basic_string<T, std::char_traits<T>, Allocator> Base;
public:
string_propagate_test_wrapper()
: Base()
+11 -2
View File
@@ -7,10 +7,8 @@
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <memory>
#include <iostream>
#include <functional>
#include <boost/container/vector.hpp>
#include <boost/container/allocator.hpp>
@@ -252,3 +250,14 @@ int main()
return 0;
}
/*
#include <vector>
//#include <boost/container/vector.hpp>
int main()
{
boost::container::vector<int> a;
return 0;
}
*/
-2
View File
@@ -13,10 +13,8 @@
#include <boost/container/detail/config_begin.hpp>
#include <memory>
#include <vector>
#include <iostream>
#include <functional>
#include <list>
#include <boost/move/utility_core.hpp>