Remove Boost.StaticAsser dependency

This commit is contained in:
Ion Gaztañaga committed 2024-01-02 19:46:05 +01:00
1 parent 716ec48861
commit 7c74232a40
62 files changed
+344 -348

No files matched your search

+6 -7
View File
@@ -34,7 +34,6 @@
#include <boost/move/detail/force_ptr.hpp>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/move/utility_core.hpp>
#include <cstddef>
@@ -77,7 +76,7 @@ class adaptive_pool
static const std::size_t overhead_percent = OverheadPercent;
static const std::size_t real_nodes_per_block = NodesPerBlock;
BOOST_CONTAINER_DOCIGN(BOOST_STATIC_ASSERT((Version <=2)));
BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_STATIC_ASSERT((Version <=2)));
public:
//-------
@@ -254,7 +253,7 @@ class adaptive_pool
//!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))){
@@ -275,7 +274,7 @@ class adaptive_pool
//!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;
BOOST_CONTAINER_MEMCHAIN_INIT(&ch);
if(BOOST_UNLIKELY(!dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){
@@ -390,7 +389,7 @@ class private_adaptive_pool
static const std::size_t overhead_percent = OverheadPercent;
static const std::size_t real_nodes_per_block = NodesPerBlock;
BOOST_CONTAINER_DOCIGN(BOOST_STATIC_ASSERT((Version <=2)));
BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_STATIC_ASSERT((Version <=2)));
typedef dtl::private_adaptive_node_pool
<sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> pool_t;
@@ -546,7 +545,7 @@ class private_adaptive_pool
//!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 ));
if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes
( n_elements, elem_size*sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS
, move_detail::force_ptr<dlmalloc_memchain *>(&chain)))){
@@ -558,7 +557,7 @@ class private_adaptive_pool
//!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 ));
if(BOOST_UNLIKELY(!dlmalloc_multialloc_arrays
(n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS
, move_detail::force_ptr<dlmalloc_memchain *>(&chain)))){
+11 -12
View File
@@ -26,7 +26,6 @@
#include <boost/container/throw_exception.hpp>
#include <boost/container/detail/dlmalloc.hpp>
#include <boost/container/detail/multiallocation_chain.hpp>
#include <boost/static_assert.hpp>
#include <boost/move/detail/force_ptr.hpp>
@@ -120,10 +119,10 @@ class allocator
BOOST_CONTAINER_ALLOCATE_NEW | BOOST_CONTAINER_EXPAND_BWD | BOOST_CONTAINER_EXPAND_FWD ;
//The mask can't disable all the allocation types
BOOST_STATIC_ASSERT(( (AllocationDisableMask & ForbiddenMask) != ForbiddenMask ));
BOOST_CONTAINER_STATIC_ASSERT(( (AllocationDisableMask & ForbiddenMask) != ForbiddenMask ));
//The mask is only valid for version 2 allocators
BOOST_STATIC_ASSERT(( Version != 1 || (AllocationDisableMask == 0) ));
BOOST_CONTAINER_STATIC_ASSERT(( Version != 1 || (AllocationDisableMask == 0) ));
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -227,7 +226,7 @@ class allocator
size_type &prefer_in_recvd_out_size,
pointer &reuse)
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
const allocation_type mask(AllocationDisableMask);
command &= ~mask;
pointer ret = this->priv_allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse);
@@ -243,7 +242,7 @@ class allocator
//!This function is available only with Version == 2
BOOST_CONTAINER_ATTRIBUTE_NODISCARD 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);
}
@@ -253,7 +252,7 @@ class allocator
//!This function is available only with Version == 2
BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline pointer allocate_one()
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
return this->allocate(1);
}
@@ -262,7 +261,7 @@ class allocator
//!This function is available only with Version == 2
inline void allocate_individual(std::size_t num_elements, multiallocation_chain &chain)
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
this->allocate_many(1, num_elements, chain);
}
@@ -272,7 +271,7 @@ class allocator
//Never throws
void deallocate_one(pointer p) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
return this->deallocate(p, 1);
}
@@ -281,7 +280,7 @@ class allocator
inline
void deallocate_individual(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
return this->deallocate_many(chain);
}
@@ -290,7 +289,7 @@ class allocator
//!This function is available only with Version == 2
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(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch)){
@@ -312,7 +311,7 @@ class allocator
//!This function is available only with Version == 2
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;
BOOST_CONTAINER_MEMCHAIN_INIT(&ch);
if(!dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch)){
@@ -334,7 +333,7 @@ class allocator
//!This function is available only with Version == 2
void deallocate_many(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_STATIC_ASSERT(( Version > 1 ));
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
dlmalloc_memchain ch;
void *beg(&*chain.begin()), *last(&*chain.last());
size_t size(chain.size());
@@ -44,8 +44,6 @@
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#include <boost/move/detail/fwd_macros.hpp>
#endif
// other boost
#include <boost/static_assert.hpp>
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+1 -1
View File
@@ -75,7 +75,7 @@ struct deque_value_traits
template<class T, std::size_t BlockBytes, std::size_t BlockSize>
struct deque_block_size
{
BOOST_STATIC_ASSERT_MSG(!(BlockBytes && BlockSize), "BlockBytes and BlockSize can't be specified at the same time");
BOOST_CONTAINER_STATIC_ASSERT_MSG(!(BlockBytes && BlockSize), "BlockBytes and BlockSize can't be specified at the same time");
static const std::size_t block_bytes = BlockBytes ? BlockBytes : 512u;
static const std::size_t value = BlockSize ? BlockSize : (sizeof(T) < block_bytes ? (block_bytes/sizeof(T)) : std::size_t(1));
};
+1 -2
View File
@@ -27,7 +27,6 @@
#include <boost/container/allocator_traits.hpp>
#include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/value_init.hpp>
#include <boost/static_assert.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/intrusive/detail/reverse_iterator.hpp>
@@ -868,7 +867,7 @@ class iterator_from_iiterator
inline iterator_from_iiterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
{
//If the iterator_from_iiterator is not a bidirectional iterator, operator-- should not exist
BOOST_STATIC_ASSERT((is_bidirectional_iterator<iterator_from_iiterator>::value));
BOOST_CONTAINER_STATIC_ASSERT((is_bidirectional_iterator<iterator_from_iiterator>::value));
--this->m_iit; return *this;
}
@@ -28,7 +28,6 @@
#include <boost/container/detail/workaround.hpp>
#include <climits>
#include <boost/static_assert.hpp>
namespace boost {
namespace container {
@@ -128,7 +127,7 @@ inline std::size_t floor_log2 (std::size_t x)
{
const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT;
const bool Size_t_Bits_Power_2= !(Bits & (Bits-1));
BOOST_STATIC_ASSERT(((Size_t_Bits_Power_2)== true));
BOOST_CONTAINER_STATIC_ASSERT(((Size_t_Bits_Power_2)== true));
std::size_t n = x;
std::size_t log2 = 0;
@@ -26,8 +26,6 @@
// container/detail
#include <boost/container/detail/min_max.hpp>
#include <boost/static_assert.hpp>
namespace boost {
namespace container {
namespace dtl {
@@ -35,10 +33,10 @@ namespace dtl {
template<unsigned Minimum, unsigned Numerator, unsigned Denominator>
struct grow_factor_ratio
{
BOOST_STATIC_ASSERT(Numerator > Denominator);
BOOST_STATIC_ASSERT(Numerator < 100);
BOOST_STATIC_ASSERT(Denominator < 100);
BOOST_STATIC_ASSERT(Denominator == 1 || (0 != Numerator % Denominator));
BOOST_CONTAINER_STATIC_ASSERT(Numerator > Denominator);
BOOST_CONTAINER_STATIC_ASSERT(Numerator < 100);
BOOST_CONTAINER_STATIC_ASSERT(Denominator < 100);
BOOST_CONTAINER_STATIC_ASSERT(Denominator == 1 || (0 != Numerator % Denominator));
template<class SizeType>
SizeType operator()(const SizeType cur_cap, const SizeType add_min_cap, const SizeType max_cap) const
@@ -505,7 +505,7 @@ struct node_alloc_holder
typename NodeAlloc::multiallocation_chain chain;
allocator_node_destroyer_and_chain_builder<NodeAlloc> builder(this->node_alloc(), chain);
this->icont().clear_and_dispose(builder);
//BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled<typename NodeAlloc::multiallocation_chain>::value == true));
//BOOST_CONTAINER_STATIC_ASSERT((::boost::has_move_emulation_enabled<typename NodeAlloc::multiallocation_chain>::value == true));
if(!chain.empty())
this->node_alloc().deallocate_individual(chain);
}
+18 -19
View File
@@ -25,7 +25,6 @@
#include <boost/container/container_fwd.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/static_assert.hpp>
#include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/mpl.hpp>
@@ -166,35 +165,35 @@ struct pair
pair()
: first(), second()
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
//pair copy assignment
pair(const pair& x)
: first(x.first), second(x.second)
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
//pair move constructor
pair(BOOST_RV_REF(pair) p)
: first(::boost::move(BOOST_MOVE_TO_LV(p).first)), second(::boost::move(BOOST_MOVE_TO_LV(p).second))
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
template <class D, class S>
pair(const pair<D, S> &p)
: first(p.first), second(p.second)
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
template <class D, class S>
pair(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p)
: first(::boost::move(BOOST_MOVE_TO_LV(p).first)), second(::boost::move(BOOST_MOVE_TO_LV(p).second))
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
//pair from two values
@@ -202,7 +201,7 @@ struct pair
: first(t1)
, second(t2)
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
template<class U, class V>
@@ -210,34 +209,34 @@ struct pair
: first(::boost::forward<U>(u))
, second(::boost::forward<V>(v))
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
//And now compatibility with std::pair
pair(const std::pair<T1, T2>& x)
: first(x.first), second(x.second)
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
template <class D, class S>
pair(const std::pair<D, S>& p)
: first(p.first), second(p.second)
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
pair(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p)
: first(::boost::move(BOOST_MOVE_TO_LV(p).first)), second(::boost::move(BOOST_MOVE_TO_LV(p).second))
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
template <class D, class S>
pair(BOOST_RV_REF_BEG std::pair<D, S> BOOST_RV_REF_END p)
: first(::boost::move(BOOST_MOVE_TO_LV(p).first)), second(::boost::move(BOOST_MOVE_TO_LV(p).second))
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@@ -245,7 +244,7 @@ struct pair
pair(try_emplace_t, BOOST_FWD_REF(KeyType) k, Args && ...args)
: first(boost::forward<KeyType>(k)), second(::boost::forward<Args>(args)...)\
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
#else
@@ -255,7 +254,7 @@ struct pair
pair( try_emplace_t, BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N )\
: first(boost::forward<KeyType>(k)), second(BOOST_MOVE_FWD##N)\
{\
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
}\
//
BOOST_MOVE_ITERATE_0TO9(BOOST_PAIR_TRY_EMPLACE_CONSTRUCT_CODE)
@@ -277,7 +276,7 @@ struct pair
)\
: first(BOOST_MOVE_TMPL_GET##N), second(BOOST_MOVE_TMPL_GETQ##M)\
{ (void)p; (void)q;\
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
}\
//
BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_PAIR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE)
@@ -299,7 +298,7 @@ struct pair
pair(piecewise_construct_t, Tuple<Args1...> t1, Tuple<Args2...> t2)
: pair(t1, t2, typename build_number_seq<sizeof...(Args1)>::type(), typename build_number_seq<sizeof...(Args2)>::type())
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
# else
//piecewise construction from variadic tuple (suboptimal, without delegating constructors)
@@ -319,7 +318,7 @@ struct pair
: first (build_from_args<first_type> (::boost::move(t1)))
, second (build_from_args<second_type>(::boost::move(t2)))
{
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
}
# endif //BOOST_NO_CXX11_VARIADIC_TEMPLATES
#elif defined(BOOST_MSVC) && (_CPPLIB_VER == 520)
@@ -332,7 +331,7 @@ struct pair
, StdTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,M),::std::tr1::_Nil)> q)\
: first(BOOST_MOVE_GET_IDX##N), second(BOOST_MOVE_GET_IDXQ##M)\
{ (void)p; (void)q;\
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
}\
//
BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE)
@@ -353,7 +352,7 @@ struct pair
, StdTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(BOOST_MOVE_ADD(_VARIADIC_MAX, 3),M),::std::_Nil) > q)\
: first(BOOST_MOVE_GET_IDX##N), second(BOOST_MOVE_GET_IDXQ##M)\
{ (void)p; (void)q;\
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
BOOST_CONTAINER_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
}\
//
BOOST_MOVE_ITER2D_0TOMAX(BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT, BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_CODE)
@@ -190,4 +190,44 @@ BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore(T1 const&)
# define BOOST_CONTAINER_CATCH_END }
#endif
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
# define BOOST_CONTAINER_STATIC_ASSERT( ... ) static_assert(__VA_ARGS__, #__VA_ARGS__)
# else
# define BOOST_CONTAINER_STATIC_ASSERT( B ) static_assert(B, #B)
# endif
#else
namespace boost {
namespace container {
namespace dtl {
template<bool B>
struct STATIC_ASSERTION_FAILURE;
template<>
struct STATIC_ASSERTION_FAILURE<true> {};
template<unsigned> struct static_assert_test {};
}
}
}
#define BOOST_CONTAINER_STATIC_ASSERT(B) \
typedef ::boost::container::dtl::static_assert_test<\
(unsigned)sizeof(::boost::container::dtl::STATIC_ASSERTION_FAILURE<bool(B)>)>\
BOOST_JOIN(boost_container_static_assert_typedef_, __LINE__) BOOST_ATTRIBUTE_UNUSED
#endif
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
# define BOOST_CONTAINER_STATIC_ASSERT_MSG( ... ) static_assert(__VA_ARGS__)
# else
# define BOOST_CONTAINER_STATIC_ASSERT_MSG( B, Msg ) static_assert( B, Msg )
# endif
#else
# define BOOST_CONTAINER_STATIC_ASSERT_MSG( B, Msg ) BOOST_CONTAINER_STATIC_ASSERT( B )
#endif
#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
+2 -2
View File
@@ -198,7 +198,7 @@ class flat_map
typedef BOOST_CONTAINER_IMPDEF(impl_value_type) movable_value_type;
//AllocatorOrContainer::value_type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, value_type>::value));
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, value_type>::value));
//////////////////////////////////////////////
//
@@ -1851,7 +1851,7 @@ class flat_multimap
typedef BOOST_CONTAINER_IMPDEF(impl_value_type) movable_value_type;
//AllocatorOrContainer::value_type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, value_type>::value));
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, value_type>::value));
//////////////////////////////////////////////
//
+2 -4
View File
@@ -44,8 +44,6 @@
// intrusive/detail
#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
#include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal
// other
#include <boost/static_assert.hpp>
// std
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list>
@@ -130,7 +128,7 @@ class map
(insert_return_type_base<iterator BOOST_MOVE_I node_type>) insert_return_type;
//allocator_type::value_type type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((dtl::is_same<typename allocator_type::value_type, std::pair<const Key, T> >::value));
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<typename allocator_type::value_type, std::pair<const Key, T> >::value));
//////////////////////////////////////////////
//
@@ -1460,7 +1458,7 @@ class multimap
<key_type BOOST_MOVE_I mapped_type> >) node_type;
//allocator_type::value_type type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((dtl::is_same<typename allocator_type::value_type, std::pair<const Key, T> >::value));
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<typename allocator_type::value_type, std::pair<const Key, T> >::value));
//////////////////////////////////////////////
//
+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();
+3 -4
View File
@@ -21,7 +21,6 @@
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/static_assert.hpp>
#include <boost/container/detail/placement_new.hpp>
#include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/container/allocator_traits.hpp>
@@ -258,7 +257,7 @@ class node_handle
//! <b>Throws</b>: Nothing.
value_type& value() const BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT((dtl::is_same<KeyMapped, void>::value));
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<KeyMapped, void>::value));
BOOST_ASSERT(!empty());
return m_ptr->get_data();
}
@@ -273,7 +272,7 @@ class node_handle
//! <b>Requires</b>: Modifying the key through the returned reference is permitted.
key_type& key() const BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT((!dtl::is_same<KeyMapped, void>::value));
BOOST_CONTAINER_STATIC_ASSERT((!dtl::is_same<KeyMapped, void>::value));
BOOST_ASSERT(!empty());
return const_cast<key_type &>(KeyMapped().key_of_value(m_ptr->get_data()));
}
@@ -286,7 +285,7 @@ class node_handle
//! <b>Throws</b>: Nothing.
mapped_type& mapped() const BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT((!dtl::is_same<KeyMapped, void>::value));
BOOST_CONTAINER_STATIC_ASSERT((!dtl::is_same<KeyMapped, void>::value));
BOOST_ASSERT(!empty());
return KeyMapped().mapped_of_value(m_ptr->get_data());
}
+2 -2
View File
@@ -23,8 +23,8 @@
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/intrusive/pack_options.hpp>
#include <boost/static_assert.hpp>
namespace boost {
namespace container {
@@ -608,7 +608,7 @@ struct deque_opt
{
static const std::size_t block_bytes = BlockBytes;
static const std::size_t block_size = BlockSize;
BOOST_STATIC_ASSERT_MSG(!(block_bytes && block_size), "block_bytes and block_size can't be specified at the same time");
BOOST_CONTAINER_STATIC_ASSERT_MSG(!(block_bytes && block_size), "block_bytes and block_size can't be specified at the same time");
};
typedef deque_opt<0u, 0u> deque_null_opt;
@@ -87,7 +87,7 @@ class resource_adaptor_imp
void static_assert_if_not_char_allocator() const
{
//This class can only be used with allocators type char
BOOST_STATIC_ASSERT((boost::container::dtl::is_same<typename Allocator::value_type, char>::value));
BOOST_CONTAINER_STATIC_ASSERT((boost::container::dtl::is_same<typename Allocator::value_type, char>::value));
}
#endif
+1 -1
View File
@@ -87,7 +87,7 @@ class static_storage_allocator
{ return true; }
private:
BOOST_STATIC_ASSERT_MSG(!InplaceAlignment || (InplaceAlignment & (InplaceAlignment-1)) == 0, "Alignment option must be zero or power of two");
BOOST_CONTAINER_STATIC_ASSERT_MSG(!InplaceAlignment || (InplaceAlignment & (InplaceAlignment-1)) == 0, "Alignment option must be zero or power of two");
static const std::size_t final_alignment = InplaceAlignment ? InplaceAlignment : dtl::alignment_of<T>::value;
typename dtl::aligned_storage<sizeof(T)*N, final_alignment>::type storage;
};
+1 -3
View File
@@ -49,8 +49,6 @@
#include <boost/move/adl_move_swap.hpp>
#include <boost/move/traits.hpp>
#include <boost/static_assert.hpp>
#include <iosfwd>
#include <istream> //
#include <ostream>
@@ -275,7 +273,7 @@ class basic_string_base
//Access and copy (to avoid UB) the first byte of the union to know if the
//active representation is short or long
short_header hdr;
BOOST_STATIC_ASSERT((sizeof(short_header) == 1));
BOOST_CONTAINER_STATIC_ASSERT((sizeof(short_header) == 1));
*(unsigned char*)&hdr = *(unsigned char*)&this->members_.m_repr;
return hdr.is_short != 0;
}
+2 -2
View File
@@ -822,7 +822,7 @@ private:
typedef value_less<T> value_less_t;
//If provided the stored_size option must specify a type that is equal or a type that is smaller.
BOOST_STATIC_ASSERT( (sizeof(stored_size_type) < sizeof(alloc_size_type) ||
BOOST_CONTAINER_STATIC_ASSERT( (sizeof(stored_size_type) < sizeof(alloc_size_type) ||
dtl::is_same<stored_size_type, alloc_size_type>::value) );
typedef typename dtl::version<allocator_type>::type alloc_version;
@@ -1094,7 +1094,7 @@ private:
//! <b>Complexity</b>: Constant.
vector(BOOST_RV_REF(vector) x) BOOST_NOEXCEPT_OR_NOTHROW
: m_holder(boost::move(x.m_holder))
{ BOOST_STATIC_ASSERT((!allocator_traits_type::is_partially_propagable::value)); }
{ BOOST_CONTAINER_STATIC_ASSERT((!allocator_traits_type::is_partially_propagable::value)); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a