Reduce redundant instantiations to improve test build times

This commit is contained in:
Ion Gaztañaga
2016-02-23 13:29:46 +01:00
parent e6182f025c
commit 33b331da38
12 changed files with 10 additions and 630 deletions
-132
View File
@@ -73,138 +73,6 @@ class simple_allocator
{ return false; }
};
//Version 2 allocator with rebind
template<class T>
class dummy_test_allocator
{
private:
typedef dummy_test_allocator<T> self_t;
typedef void * aux_pointer_t;
typedef const void * cvoid_ptr;
public:
typedef T value_type;
typedef T * pointer;
typedef const T * const_pointer;
typedef typename container_detail::
unvoid_ref<value_type>::type reference;
typedef typename container_detail::
unvoid_ref<const value_type>::type const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef container_detail::basic_multiallocation_chain
<void*> multialloc_cached_counted;
typedef boost::container::container_detail::transform_multiallocation_chain
<multialloc_cached_counted, value_type> multiallocation_chain;
typedef boost::container::container_detail::version_type<dummy_test_allocator, 2> version;
template<class T2>
struct rebind
{ typedef dummy_test_allocator<T2> other; };
//!Default constructor. Never throws
dummy_test_allocator()
{}
//!Constructor from other dummy_test_allocator. Never throws
dummy_test_allocator(const dummy_test_allocator &)
{}
//!Constructor from related dummy_test_allocator. Never throws
template<class T2>
dummy_test_allocator(const dummy_test_allocator<T2> &)
{}
pointer address(reference value)
{ return pointer(container_detail::addressof(value)); }
const_pointer address(const_reference value) const
{ return const_pointer(container_detail::addressof(value)); }
pointer allocate(size_type, cvoid_ptr = 0)
{ return 0; }
void deallocate(const pointer &, size_type)
{ }
template<class Convertible>
void construct(pointer, const Convertible &)
{}
void destroy(pointer)
{}
size_type max_size() const
{ return 0; }
friend void swap(self_t &, self_t &)
{}
//Experimental version 2 dummy_test_allocator functions
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.
size_type size(const pointer &) const
{ return 0; }
//!Allocates just one object. Memory allocated with this function
//!must be deallocated only with deallocate_one().
//!Throws boost::container::bad_alloc if there is no enough memory
pointer allocate_one()
{ return pointer(); }
//!Deallocates memory previously allocated with allocate_one().
//!You should never use deallocate_one to deallocate memory allocated
//!with other functions different from allocate_one(). Never throws
void deallocate_one(const pointer &)
{}
//!Allocates many elements of size == 1 in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
//!the preferred and maximum number is
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
void allocate_individual(size_type, multiallocation_chain &)
{}
//!Allocates many elements of size == 1 in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
//!the preferred and maximum number is
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
void deallocate_individual(multiallocation_chain &)
{}
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
//!the preferred and maximum number is
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
void deallocate_many(multiallocation_chain &)
{}
};
//!Equality test for same type of dummy_test_allocator
template<class T> inline
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> &,
const dummy_test_allocator<T> &)
{ return false; }
template< class T
, bool PropagateOnContCopyAssign
, bool PropagateOnContMoveAssign