Remove Boost.StaticAsser dependency

This commit is contained in:
Ion Gaztañaga
2024-01-02 19:46:05 +01:00
parent 716ec48861
commit 7c74232a40
62 changed files with 344 additions and 348 deletions
+10 -11
View File
@@ -30,7 +30,6 @@
#include <boost/container/detail/singleton.hpp>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <cstddef>
namespace boost {
@@ -65,7 +64,7 @@ class node_allocator
static const std::size_t nodes_per_block = NodesPerBlock;
BOOST_STATIC_ASSERT((Version <=2));
BOOST_CONTAINER_STATIC_ASSERT((Version <=2));
#endif
public:
@@ -189,7 +188,7 @@ class node_allocator
pointer allocation_command
(allocation_type command, size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse)
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
pointer ret = this->priv_allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse);
if(BOOST_UNLIKELY(!ret && !(command & BOOST_CONTAINER_NOTHROW_ALLOCATION)))
boost::container::throw_bad_alloc();
@@ -200,7 +199,7 @@ class node_allocator
//!pointed by p can hold.
size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
return dlmalloc_size(p);
}
@@ -209,7 +208,7 @@ class node_allocator
//!Throws bad_alloc if there is no enough memory
pointer allocate_one()
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
typedef dtl::shared_node_pool
<sizeof(T), NodesPerBlock> shared_pool_t;
typedef dtl::singleton_default<shared_pool_t> singleton_t;
@@ -220,7 +219,7 @@ class node_allocator
//!Elements must be individually deallocated with deallocate_one()
void allocate_individual(std::size_t num_elements, multiallocation_chain &chain)
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
typedef dtl::shared_node_pool
<sizeof(T), NodesPerBlock> shared_pool_t;
typedef dtl::singleton_default<shared_pool_t> singleton_t;
@@ -234,7 +233,7 @@ class node_allocator
//!with other functions different from allocate_one(). Never throws
void deallocate_one(pointer p) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
typedef dtl::shared_node_pool
<sizeof(T), NodesPerBlock> shared_pool_t;
typedef dtl::singleton_default<shared_pool_t> singleton_t;
@@ -243,7 +242,7 @@ class node_allocator
void deallocate_individual(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
typedef dtl::shared_node_pool
<sizeof(T), NodesPerBlock> shared_pool_t;
typedef dtl::singleton_default<shared_pool_t> singleton_t;
@@ -255,7 +254,7 @@ class node_allocator
//!Elements must be individually deallocated with deallocate()
void allocate_many(size_type elem_size, std::size_t n_elements, multiallocation_chain &chain)
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
dlmalloc_memchain ch;
BOOST_CONTAINER_MEMCHAIN_INIT(&ch);
if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){
@@ -271,7 +270,7 @@ class node_allocator
//!Elements must be individually deallocated with deallocate()
void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain)
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
dlmalloc_memchain ch;
dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch);
if(BOOST_UNLIKELY(BOOST_CONTAINER_MEMCHAIN_EMPTY(&ch))){
@@ -285,7 +284,7 @@ class node_allocator
void deallocate_many(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
void *first = &*chain.begin();
void *last = &*chain.last();
size_t num = chain.size();