mirror of
https://github.com/boostorg/container.git
synced 2025-07-31 04:57:16 +02:00
Add compile-time check to make sure allocator_type::value_type and container's value_type are the same type.
This commit is contained in:
@ -1026,6 +1026,11 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
|
||||
private: // Internal typedefs
|
||||
|
||||
//`allocator_type::value_type` must match container's `value type`. If this
|
||||
//assertion fails, please review your allocator definition.
|
||||
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<value_type, typename allocator_traits<ValAllocator>::value_type>::value));
|
||||
|
||||
BOOST_COPYABLE_AND_MOVABLE(deque)
|
||||
typedef typename Base::ptr_alloc_ptr index_pointer;
|
||||
typedef allocator_traits<ValAllocator> allocator_traits_type;
|
||||
|
@ -592,6 +592,10 @@ class flat_tree
|
||||
typedef typename container_type::reverse_iterator reverse_iterator;
|
||||
typedef typename container_type::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
//`allocator_type::value_type` must match container's `value type`. If this
|
||||
//assertion fails, please review your allocator definition.
|
||||
BOOST_CONTAINER_STATIC_ASSERT((is_same<value_type, typename allocator_traits_type::value_type>::value));
|
||||
|
||||
//!Standard extension
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::container::dtl::, container_type
|
||||
@ -733,7 +737,8 @@ class flat_tree
|
||||
}
|
||||
|
||||
inline ~flat_tree()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
inline flat_tree& operator=(BOOST_COPY_ASSIGN_REF(flat_tree) x)
|
||||
{ m_data = x.m_data; return *this; }
|
||||
|
@ -456,6 +456,10 @@ class tree
|
||||
|
||||
private:
|
||||
|
||||
//`allocator_type::value_type` must match container's `value type`. If this
|
||||
//assertion fails, please review your allocator definition.
|
||||
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<value_type, typename allocator_traits<allocator_type>::value_type>::value));
|
||||
|
||||
typedef key_node_pred<key_compare, key_of_value_t, Node> KeyNodeCompare;
|
||||
|
||||
public:
|
||||
|
@ -173,6 +173,11 @@ class devector
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
|
||||
//`allocator_type::value_type` must match container's `value type`. If this
|
||||
//assertion fails, please review your allocator definition.
|
||||
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<value_type, typename allocator_traits<allocator_type>::value_type>::value));
|
||||
|
||||
BOOST_COPYABLE_AND_MOVABLE(devector)
|
||||
|
||||
// Guard to deallocate buffer on exception
|
||||
|
@ -1378,6 +1378,10 @@ class list
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
|
||||
//`allocator_type::value_type` must match container's `value type`. If this
|
||||
//assertion fails, please review your allocator definition.
|
||||
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<value_type, typename allocator_traits_type::value_type>::value));
|
||||
|
||||
void priv_move_assign(BOOST_RV_REF(list) x, dtl::bool_<true> /*steal_resources*/)
|
||||
{
|
||||
//Destroy objects but retain memory in case x reuses it in the future
|
||||
|
@ -1565,6 +1565,11 @@ class slist
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
|
||||
//`allocator_type::value_type` must match container's `value type`. If this
|
||||
//assertion fails, please review your allocator definition.
|
||||
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<value_type, typename allocator_traits_type::value_type>::value));
|
||||
|
||||
void priv_move_assign(BOOST_RV_REF(slist) x, dtl::bool_<true> /*steal_resources*/)
|
||||
{
|
||||
//Destroy objects but retain memory in case x reuses it in the future
|
||||
|
@ -597,6 +597,11 @@ class stable_vector
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
|
||||
//`allocator_type::value_type` must match container's `value type`. If this
|
||||
//assertion fails, please review your allocator definition.
|
||||
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<value_type, typename allocator_traits<allocator_type>::value_type>::value));
|
||||
|
||||
BOOST_COPYABLE_AND_MOVABLE(stable_vector)
|
||||
BOOST_STATIC_CONSTEXPR size_type ExtraPointers = index_traits_type::ExtraPointers;
|
||||
|
||||
|
@ -628,6 +628,11 @@ class basic_string
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
|
||||
//`allocator_type::value_type` must match container's `value type`. If this
|
||||
//assertion fails, please review your allocator definition.
|
||||
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<value_type, typename allocator_traits<allocator_type>::value_type>::value));
|
||||
|
||||
typedef constant_iterator<CharT> cvalue_iterator;
|
||||
typedef typename base_t::alloc_version alloc_version;
|
||||
typedef ::boost::intrusive::pointer_traits<pointer> pointer_traits;
|
||||
|
@ -813,8 +813,11 @@ public:
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
|
||||
private:
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
//`allocator_type::value_type` must match container's `value type`. If this
|
||||
//assertion fails, please review your allocator definition.
|
||||
BOOST_CONTAINER_STATIC_ASSERT((dtl::is_same<value_type, typename allocator_traits_t::value_type>::value));
|
||||
|
||||
typedef typename boost::container::
|
||||
allocator_traits<allocator_type>::size_type alloc_size_type;
|
||||
typedef typename get_vector_opt<Options, alloc_size_type>::type options_type;
|
||||
|
Reference in New Issue
Block a user