forked from boostorg/container
Fixes #206 ("operator-> on static_vector::iterator causes cast alignment warning")
This commit is contained in:
@ -33,6 +33,8 @@
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp> //adl_move_swap
|
||||
|
||||
#include <boost/move/detail/force_ptr.hpp> //adl_move_swap
|
||||
|
||||
|
||||
#include "varray_util.hpp"
|
||||
|
||||
@ -2105,12 +2107,12 @@ private:
|
||||
|
||||
pointer ptr()
|
||||
{
|
||||
return pointer(reinterpret_cast<Value*>(this));
|
||||
return pointer(move_detail::force_ptr<Value*>(this));
|
||||
}
|
||||
|
||||
const_pointer ptr() const
|
||||
{
|
||||
return const_pointer(reinterpret_cast<const Value*>(this));
|
||||
return const_pointer(move_detail::force_ptr<const Value*>(this));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1338,6 +1338,14 @@ use [*Boost.Container]? There are several reasons for that:
|
||||
|
||||
[section:release_notes Release Notes]
|
||||
|
||||
[section:release_notes_boost_1_79_00 Boost 1.79 Release]
|
||||
|
||||
* The library now compiles without warnings with GCC's -Wcast-align=strict
|
||||
* Fixed bugs/issues:
|
||||
* [@https://github.com/boostorg/container/issues/206 GitHub #206: ['"operator-> on static_vector::iterator causes cast alignment warning"]].
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:release_notes_boost_1_78_00 Boost 1.78 Release]
|
||||
|
||||
* Fixed bugs/issues:
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <boost/container/detail/singleton.hpp>
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
@ -263,7 +265,8 @@ class adaptive_pool
|
||||
,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch)
|
||||
,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );*/
|
||||
if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes
|
||||
(n_elements, elem_size*sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain)))){
|
||||
( n_elements, elem_size*sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS
|
||||
, move_detail::force_ptr<dlmalloc_memchain *>(&chain)))){
|
||||
boost::container::throw_bad_alloc();
|
||||
}
|
||||
}
|
||||
@ -283,7 +286,8 @@ class adaptive_pool
|
||||
,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch)
|
||||
,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );*/
|
||||
if(BOOST_UNLIKELY(!dlmalloc_multialloc_arrays
|
||||
(n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain)))){
|
||||
( n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS
|
||||
, move_detail::force_ptr<dlmalloc_memchain *>(&chain)))){
|
||||
boost::container::throw_bad_alloc();
|
||||
}
|
||||
}
|
||||
@ -295,7 +299,7 @@ class adaptive_pool
|
||||
size_t size(chain.size());
|
||||
BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, size);
|
||||
dlmalloc_multidealloc(&ch);*/
|
||||
dlmalloc_multidealloc(reinterpret_cast<dlmalloc_memchain *>(&chain));
|
||||
dlmalloc_multidealloc(move_detail::force_ptr<dlmalloc_memchain *>(&chain));
|
||||
}
|
||||
|
||||
//!Deallocates all free blocks of the pool
|
||||
@ -544,7 +548,8 @@ class private_adaptive_pool
|
||||
{
|
||||
BOOST_STATIC_ASSERT(( Version > 1 ));
|
||||
if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes
|
||||
(n_elements, elem_size*sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain)))){
|
||||
( n_elements, elem_size*sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS
|
||||
, move_detail::force_ptr<dlmalloc_memchain *>(&chain)))){
|
||||
boost::container::throw_bad_alloc();
|
||||
}
|
||||
}
|
||||
@ -555,14 +560,15 @@ class private_adaptive_pool
|
||||
{
|
||||
BOOST_STATIC_ASSERT(( Version > 1 ));
|
||||
if(BOOST_UNLIKELY(!dlmalloc_multialloc_arrays
|
||||
(n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain)))){
|
||||
(n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS
|
||||
, move_detail::force_ptr<dlmalloc_memchain *>(&chain)))){
|
||||
boost::container::throw_bad_alloc();
|
||||
}
|
||||
}
|
||||
|
||||
void deallocate_many(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
dlmalloc_multidealloc(reinterpret_cast<dlmalloc_memchain *>(&chain));
|
||||
dlmalloc_multidealloc(move_detail::force_ptr<dlmalloc_memchain *>(&chain));
|
||||
}
|
||||
|
||||
//!Deallocates all free blocks of the pool
|
||||
|
@ -27,6 +27,9 @@
|
||||
#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>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cassert>
|
||||
|
||||
@ -298,7 +301,8 @@ class allocator
|
||||
,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch)
|
||||
,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );
|
||||
/*
|
||||
if(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain))){
|
||||
if(!dlmalloc_multialloc_nodes( n_elements, elem_size*sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS
|
||||
, move_detail::force_ptr<dlmalloc_memchain *>(&chain))){
|
||||
boost::container::throw_bad_alloc();
|
||||
}*/
|
||||
}
|
||||
@ -319,7 +323,8 @@ class allocator
|
||||
,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch)
|
||||
,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );
|
||||
/*
|
||||
if(!dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain))){
|
||||
if(!dlmalloc_multialloc_arrays( n_elements, elem_sizes, sizeof(T), BOOST_CONTAINER_DL_MULTIALLOC_DEFAULT_CONTIGUOUS
|
||||
, move_detail::force_ptr<dlmalloc_memchain *>(&chain))){
|
||||
boost::container::throw_bad_alloc();
|
||||
}*/
|
||||
}
|
||||
@ -335,7 +340,7 @@ class allocator
|
||||
size_t size(chain.size());
|
||||
BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, size);
|
||||
dlmalloc_multidealloc(&ch);
|
||||
//dlmalloc_multidealloc(reinterpret_cast<dlmalloc_memchain *>(&chain));
|
||||
//dlmalloc_multidealloc(move_detail::force_ptr<dlmalloc_memchain *>(&chain));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/move/detail/to_raw_pointer.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
// intrusive
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
@ -540,7 +541,7 @@ class private_adaptive_node_pool_impl_common
|
||||
BOOST_ASSERT(hdr_off_holder->hdr_offset == offset);
|
||||
BOOST_ASSERT(0 == (reinterpret_cast<std::size_t>(hdr_off_holder) & (real_block_alignment - 1)));
|
||||
BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (real_block_alignment - 1)));
|
||||
hdr_off_holder = reinterpret_cast<hdr_offset_holder *>(reinterpret_cast<char*>(hdr_off_holder) + real_block_alignment);
|
||||
hdr_off_holder = move_detail::force_ptr<hdr_offset_holder *>(reinterpret_cast<char*>(hdr_off_holder) + real_block_alignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -563,7 +564,7 @@ class private_adaptive_node_pool_impl_common
|
||||
|
||||
hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block, const size_type num_subblocks, const size_type real_block_alignment, AlignOnlyFalse) const
|
||||
{
|
||||
hdr_offset_holder *const hdr_off_holder = reinterpret_cast<hdr_offset_holder*>
|
||||
hdr_offset_holder *const hdr_off_holder = move_detail::force_ptr<hdr_offset_holder*>
|
||||
(reinterpret_cast<char*>(block) - (num_subblocks-1)*real_block_alignment);
|
||||
BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast<char*>(block) - reinterpret_cast<char*>(hdr_off_holder)));
|
||||
BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (real_block_alignment - 1)));
|
||||
@ -574,7 +575,7 @@ class private_adaptive_node_pool_impl_common
|
||||
hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block, const size_type num_subblocks, const size_type real_block_alignment, AlignOnlyTrue) const
|
||||
{
|
||||
(void)num_subblocks; (void)real_block_alignment;
|
||||
return reinterpret_cast<hdr_offset_holder*>(block);
|
||||
return move_detail::force_ptr<hdr_offset_holder*>(block);
|
||||
}
|
||||
|
||||
void priv_deallocate_free_blocks_impl( const size_type max_free_blocks, const size_type real_num_node
|
||||
@ -903,7 +904,7 @@ class private_adaptive_node_pool_impl_common
|
||||
reinterpret_cast<hdr_offset_holder*>((std::size_t)node & size_type(~(real_block_alignment - 1)));
|
||||
BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (real_block_alignment - 1)));
|
||||
BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (real_block_alignment - 1)));
|
||||
block_info_t *block = reinterpret_cast<block_info_t *>
|
||||
block_info_t *block = move_detail::force_ptr<block_info_t *>
|
||||
(reinterpret_cast<char*>(hdr_off_holder) + hdr_off_holder->hdr_offset);
|
||||
BOOST_ASSERT(block->hdr_offset == 0);
|
||||
return block;
|
||||
|
@ -18,21 +18,13 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/move/detail/addressof.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace dtl {
|
||||
|
||||
template <typename T>
|
||||
BOOST_CONTAINER_FORCEINLINE T* addressof(T& obj)
|
||||
{
|
||||
return static_cast<T*>(
|
||||
static_cast<void*>(
|
||||
const_cast<char*>(
|
||||
&reinterpret_cast<const volatile char&>(obj)
|
||||
)));
|
||||
}
|
||||
using boost::move_detail::addressof;
|
||||
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
|
@ -36,7 +36,9 @@
|
||||
#include <boost/move/detail/fwd_macros.hpp>
|
||||
#endif
|
||||
// move
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
// other
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
@ -129,7 +131,7 @@ struct insert_value_initialized_n_proxy
|
||||
while (n){
|
||||
--n;
|
||||
storage_t v;
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);
|
||||
value_type *vp = move_detail::force_ptr<value_type *>(static_cast<void *>(v.data));
|
||||
alloc_traits::construct(a, vp);
|
||||
value_destructor<Allocator> on_exit(a, *vp); (void)on_exit;
|
||||
*p = ::boost::move(*vp);
|
||||
@ -154,7 +156,7 @@ struct insert_default_initialized_n_proxy
|
||||
while (n){
|
||||
--n;
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);
|
||||
value_type *vp = move_detail::force_ptr<value_type *>(v.data);
|
||||
alloc_traits::construct(a, vp, default_init);
|
||||
value_destructor<Allocator> on_exit(a, *vp); (void)on_exit;
|
||||
*p = ::boost::move(*vp);
|
||||
@ -295,7 +297,7 @@ struct insert_emplace_proxy
|
||||
{
|
||||
BOOST_ASSERT(n ==1); (void)n;
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);
|
||||
value_type *vp = move_detail::force_ptr<value_type *>(v.data);
|
||||
alloc_traits::construct(a, vp, ::boost::forward<Args>(get<IdxPack>(this->args_))...);
|
||||
BOOST_TRY{
|
||||
*p = ::boost::move(*vp);
|
||||
@ -415,7 +417,7 @@ struct insert_emplace_proxy_arg##N\
|
||||
{\
|
||||
BOOST_ASSERT(n == 1); (void)n;\
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);\
|
||||
value_type *vp = move_detail::force_ptr<value_type *>(v.data);\
|
||||
alloc_traits::construct(a, vp BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\
|
||||
BOOST_TRY{\
|
||||
*p = ::boost::move(*vp);\
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <boost/move/make_unique.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
#include <boost/move/algo/adaptive_sort.hpp>
|
||||
#include <boost/move/algo/detail/pdqsort.hpp>
|
||||
|
||||
@ -960,7 +961,7 @@ class flat_tree
|
||||
std::pair<iterator, bool> emplace_unique(BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
|
||||
value_type *pval = reinterpret_cast<value_type *>(v.data);
|
||||
value_type *pval = move_detail::force_ptr<value_type *>(v.data);
|
||||
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();
|
||||
stored_allocator_traits::construct(a, pval, ::boost::forward<Args>(args)... );
|
||||
value_destructor<stored_allocator_type, value_type> d(a, *pval);
|
||||
@ -972,7 +973,7 @@ class flat_tree
|
||||
{
|
||||
//hint checked in insert_unique
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
|
||||
value_type *pval = reinterpret_cast<value_type *>(v.data);
|
||||
value_type *pval = move_detail::force_ptr<value_type *>(v.data);
|
||||
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();
|
||||
stored_allocator_traits::construct(a, pval, ::boost::forward<Args>(args)... );
|
||||
value_destructor<stored_allocator_type, value_type> d(a, *pval);
|
||||
@ -983,7 +984,7 @@ class flat_tree
|
||||
iterator emplace_equal(BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
|
||||
value_type *pval = reinterpret_cast<value_type *>(v.data);
|
||||
value_type *pval = move_detail::force_ptr<value_type *>(v.data);
|
||||
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();
|
||||
stored_allocator_traits::construct(a, pval, ::boost::forward<Args>(args)... );
|
||||
value_destructor<stored_allocator_type, value_type> d(a, *pval);
|
||||
@ -995,7 +996,7 @@ class flat_tree
|
||||
{
|
||||
//hint checked in insert_equal
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
|
||||
value_type *pval = reinterpret_cast<value_type *>(v.data);
|
||||
value_type *pval = move_detail::force_ptr<value_type *>(v.data);
|
||||
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();
|
||||
stored_allocator_traits::construct(a, pval, ::boost::forward<Args>(args)... );
|
||||
value_destructor<stored_allocator_type, value_type> d(a, *pval);
|
||||
@ -1029,7 +1030,7 @@ class flat_tree
|
||||
std::pair<iterator, bool> emplace_unique(BOOST_MOVE_UREF##N)\
|
||||
{\
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
|
||||
value_type *pval = reinterpret_cast<value_type *>(v.data);\
|
||||
value_type *pval = move_detail::force_ptr<value_type *>(v.data);\
|
||||
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\
|
||||
stored_allocator_traits::construct(a, pval BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
value_destructor<stored_allocator_type, value_type> d(a, *pval);\
|
||||
@ -1040,7 +1041,7 @@ class flat_tree
|
||||
iterator emplace_hint_unique(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||
{\
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
|
||||
value_type *pval = reinterpret_cast<value_type *>(v.data);\
|
||||
value_type *pval = move_detail::force_ptr<value_type *>(v.data);\
|
||||
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\
|
||||
stored_allocator_traits::construct(a, pval BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
value_destructor<stored_allocator_type, value_type> d(a, *pval);\
|
||||
@ -1051,7 +1052,7 @@ class flat_tree
|
||||
iterator emplace_equal(BOOST_MOVE_UREF##N)\
|
||||
{\
|
||||
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
|
||||
value_type *pval = reinterpret_cast<value_type *>(v.data);\
|
||||
value_type *pval = move_detail::force_ptr<value_type *>(v.data);\
|
||||
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\
|
||||
stored_allocator_traits::construct(a, pval BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
value_destructor<stored_allocator_type, value_type> d(a, *pval);\
|
||||
@ -1062,7 +1063,7 @@ class flat_tree
|
||||
iterator emplace_hint_equal(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||
{\
|
||||
typename dtl::aligned_storage <sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
|
||||
value_type *pval = reinterpret_cast<value_type *>(v.data);\
|
||||
value_type *pval = move_detail::force_ptr<value_type *>(v.data);\
|
||||
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\
|
||||
stored_allocator_traits::construct(a, pval BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
value_destructor<stored_allocator_type, value_type> d(a, *pval);\
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/pool_common.hpp>
|
||||
#include <boost/move/detail/to_raw_pointer.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
@ -344,7 +345,7 @@ class private_node_pool_impl
|
||||
//!Returns a reference to the block hook placed in the end of the block
|
||||
static node_t & get_block_hook (void *block, size_type blocksize)
|
||||
{
|
||||
return *reinterpret_cast<node_t*>(reinterpret_cast<char*>(block) + blocksize);
|
||||
return *move_detail::force_ptr<node_t*>(reinterpret_cast<char*>(block) + blocksize);
|
||||
}
|
||||
|
||||
//!Returns the starting address of the block reference to the block hook placed in the end of the block
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include <boost/move/detail/fwd_macros.hpp>
|
||||
#endif
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
// other
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
@ -145,31 +146,31 @@ struct tree_node
|
||||
# endif
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T &get_data()
|
||||
{ return *reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T &get_data() const
|
||||
{ return *reinterpret_cast<const T*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<const T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T *get_data_ptr()
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T *get_data_ptr() const
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type &get_real_data()
|
||||
{ return *reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type &get_real_data() const
|
||||
{ return *reinterpret_cast<const internal_type*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<const internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type *get_real_data_ptr()
|
||||
{ return reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type *get_real_data_ptr() const
|
||||
{ return reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE ~tree_node()
|
||||
{ reinterpret_cast<internal_type*>(this->m_storage.data)->~internal_type(); }
|
||||
{ move_detail::force_ptr<internal_type*>(this->m_storage.data)->~internal_type(); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DISABLE_ALIASING_WARNING)
|
||||
#pragma GCC diagnostic pop
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/detail/to_raw_pointer.hpp>
|
||||
#include <boost/move/algo/detail/merge.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
|
||||
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
|
||||
|
||||
@ -2549,7 +2550,7 @@ class devector
|
||||
{\
|
||||
BOOST_ASSERT(size() >= 1);\
|
||||
typename dtl::aligned_storage<sizeof(T), dtl::alignment_of<T>::value>::type v;\
|
||||
T *vp = reinterpret_cast<T *>(v.data);\
|
||||
T *vp = move_detail::force_ptr<T *>(v.data);\
|
||||
allocator_traits_type::construct(get_stored_allocator(), vp BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
T &tmp = *vp;\
|
||||
dtl::value_destructor<allocator_type> on_exit(get_stored_allocator(), tmp); (void)on_exit;\
|
||||
@ -2564,7 +2565,7 @@ class devector
|
||||
else if (back_free_capacity()) {\
|
||||
BOOST_ASSERT(size() >= 1);\
|
||||
typename dtl::aligned_storage<sizeof(T), dtl::alignment_of<T>::value>::type v;\
|
||||
T *vp = reinterpret_cast<T *>(v.data);\
|
||||
T *vp = move_detail::force_ptr<T *>(v.data);\
|
||||
allocator_traits_type::construct(get_stored_allocator(), vp BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
T &tmp = *vp;\
|
||||
dtl::value_destructor<allocator_type> on_exit(get_stored_allocator(), tmp); (void)on_exit;\
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <boost/move/detail/fwd_macros.hpp>
|
||||
#endif
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
// intrusive
|
||||
#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
|
||||
#include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal
|
||||
@ -61,12 +62,12 @@ namespace dtl{
|
||||
|
||||
template<class D, class S>
|
||||
BOOST_CONTAINER_FORCEINLINE static D &force(S &s)
|
||||
{ return *reinterpret_cast<D*>(&s); }
|
||||
{ return *move_detail::force_ptr<D*>(&s); }
|
||||
|
||||
template<class D, class S>
|
||||
BOOST_CONTAINER_FORCEINLINE static D force_copy(const S &s)
|
||||
{
|
||||
const D *const vp = reinterpret_cast<const D *>(&s);
|
||||
const D *const vp = move_detail::force_ptr<const D *>(&s);
|
||||
D ret_val(*vp);
|
||||
return ret_val;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
# include <boost/move/detail/fwd_macros.hpp>
|
||||
#endif
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
|
||||
// intrusive
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
@ -86,31 +87,31 @@ struct list_node
|
||||
# endif
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T &get_data()
|
||||
{ return *reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T &get_data() const
|
||||
{ return *reinterpret_cast<const T*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<const T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T *get_data_ptr()
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T *get_data_ptr() const
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type &get_real_data()
|
||||
{ return *reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type &get_real_data() const
|
||||
{ return *reinterpret_cast<const internal_type*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<const internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type *get_real_data_ptr()
|
||||
{ return reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type *get_real_data_ptr() const
|
||||
{ return reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE ~list_node()
|
||||
{ reinterpret_cast<T*>(this->m_storage.data)->~T(); }
|
||||
{ move_detail::force_ptr<T*>(this->m_storage.data)->~T(); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DISABLE_ALIASING_WARNING)
|
||||
#pragma GCC diagnostic pop
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <boost/move/detail/fwd_macros.hpp>
|
||||
#endif
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
// other
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
// std
|
||||
@ -91,31 +92,31 @@ struct slist_node
|
||||
# endif
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T &get_data()
|
||||
{ return *reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T &get_data() const
|
||||
{ return *reinterpret_cast<const T*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<const T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T *get_data_ptr()
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T *get_data_ptr() const
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type &get_real_data()
|
||||
{ return *reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type &get_real_data() const
|
||||
{ return *reinterpret_cast<const internal_type*>(this->m_storage.data); }
|
||||
{ return *move_detail::force_ptr<const internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type *get_real_data_ptr()
|
||||
{ return reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type *get_real_data_ptr() const
|
||||
{ return reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
{ return move_detail::force_ptr<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE ~slist_node()
|
||||
{ reinterpret_cast<T*>(this->m_storage.data)->~T(); }
|
||||
{ move_detail::force_ptr<T*>(this->m_storage.data)->~T(); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DISABLE_ALIASING_WARNING)
|
||||
#pragma GCC diagnostic pop
|
||||
|
@ -39,6 +39,7 @@
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#include <boost/move/detail/fwd_macros.hpp>
|
||||
#endif
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
|
||||
//std
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@ -324,7 +325,7 @@ class small_vector_allocator
|
||||
const_pointer internal_storage() const
|
||||
{
|
||||
const vector_alloc_holder_t &v_holder = static_cast<const vector_alloc_holder_t &>(*this);
|
||||
const vector_base &v_base = reinterpret_cast<const vector_base &>(v_holder);
|
||||
const vector_base &v_base = *move_detail::force_ptr<const vector_base *>(&v_holder);
|
||||
const derived_type &d_base = static_cast<const derived_type &>(v_base);
|
||||
return d_base.internal_storage();
|
||||
}
|
||||
@ -333,7 +334,7 @@ class small_vector_allocator
|
||||
pointer internal_storage()
|
||||
{
|
||||
vector_alloc_holder_t &v_holder = static_cast<vector_alloc_holder_t &>(*this);
|
||||
vector_base &v_base = reinterpret_cast<vector_base &>(v_holder);
|
||||
vector_base &v_base = *move_detail::force_ptr<vector_base *>(&v_holder);
|
||||
derived_type &d_base = static_cast<derived_type &>(v_base);
|
||||
return d_base.internal_storage();
|
||||
}
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
// move/detail
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
// other
|
||||
@ -165,19 +166,19 @@ struct node
|
||||
# endif
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T &get_data()
|
||||
{ return *reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return *boost::move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T &get_data() const
|
||||
{ return *reinterpret_cast<const T*>(this->m_storage.data); }
|
||||
{ return *boost::move_detail::force_ptr<const T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T *get_data_ptr()
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return boost::move_detail::force_ptr<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T *get_data_ptr() const
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
{ return boost::move_detail::force_ptr<const T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE ~node()
|
||||
{ reinterpret_cast<T*>(this->m_storage.data)->~T(); }
|
||||
{ boost::move_detail::force_ptr<T*>(this->m_storage.data)->~T(); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DISABLE_ALIASING_WARNING)
|
||||
#pragma GCC diagnostic pop
|
||||
|
@ -39,18 +39,19 @@
|
||||
#include <boost/container/detail/version_type.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp>
|
||||
|
||||
#include <boost/container/detail/minimal_char_traits_header.hpp> // for char_traits
|
||||
//intrusive
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
#include <boost/intrusive/detail/hash_combine.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
//move
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/move/traits.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/intrusive/detail/hash_combine.hpp>
|
||||
|
||||
#include <boost/container/detail/minimal_char_traits_header.hpp> // for char_traits
|
||||
#include <iosfwd>
|
||||
#include <istream> //
|
||||
#include <ostream>
|
||||
@ -227,16 +228,16 @@ class basic_string_base
|
||||
{ this->init(); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const short_t *pshort_repr() const
|
||||
{ return reinterpret_cast<const short_t*>(m_repr.data); }
|
||||
{ return move_detail::force_ptr<const short_t*>(m_repr.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const long_t *plong_repr() const
|
||||
{ return reinterpret_cast<const long_t*>(m_repr.data); }
|
||||
{ return move_detail::force_ptr<const long_t*>(m_repr.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE short_t *pshort_repr()
|
||||
{ return reinterpret_cast<short_t*>(m_repr.data); }
|
||||
{ return move_detail::force_ptr<short_t*>(m_repr.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE long_t *plong_repr()
|
||||
{ return reinterpret_cast<long_t*>(m_repr.data); }
|
||||
{ return move_detail::force_ptr<long_t*>(m_repr.data); }
|
||||
|
||||
repr_t m_repr;
|
||||
} members_;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <boost/container/uses_allocator.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
|
||||
template<class T, unsigned int Id, bool HasTrueTypes = false>
|
||||
class propagation_test_allocator
|
||||
@ -69,7 +70,7 @@ class propagation_test_allocator
|
||||
{ return std::size_t(-1); }
|
||||
|
||||
T* allocate(std::size_t n)
|
||||
{ return (T*)::new char[n*sizeof(T)]; }
|
||||
{ return boost::move_detail::force_ptr<T*>(::new char[n*sizeof(T)]); }
|
||||
|
||||
void deallocate(T*p, std::size_t)
|
||||
{ delete []static_cast<char*>(static_cast<void*>(p)); }
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
@ -77,7 +78,7 @@ class default_init_allocator
|
||||
puc_raw[i] = static_cast<unsigned char>(s_pattern--);
|
||||
}
|
||||
}
|
||||
return (Integral*)puc_raw;;
|
||||
return move_detail::force_ptr<Integral*>(puc_raw);
|
||||
}
|
||||
|
||||
void deallocate(Integral *p, std::size_t)
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <memory>
|
||||
@ -61,7 +61,7 @@ class simple_allocator
|
||||
{}
|
||||
|
||||
T* allocate(std::size_t n)
|
||||
{ return (T*)::new char[sizeof(T)*n]; }
|
||||
{ return move_detail::force_ptr<T*>(::new char[sizeof(T)*n]); }
|
||||
|
||||
void deallocate(T*p, std::size_t)
|
||||
{ delete[] ((char*)p);}
|
||||
@ -176,7 +176,7 @@ class propagation_test_allocator
|
||||
{ unique_id_ = id; }
|
||||
|
||||
T* allocate(std::size_t n)
|
||||
{ return (T*)::new char[sizeof(T)*n]; }
|
||||
{ return move_detail::force_ptr<T*>(::new char[sizeof(T)*n]); }
|
||||
|
||||
void deallocate(T*p, std::size_t)
|
||||
{ delete[] ((char*)p);}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp> //adl_move_swap
|
||||
|
||||
namespace boost{
|
||||
namespace container {
|
||||
@ -151,7 +152,7 @@ static boost::container::dtl::aligned_storage<sizeof(EmplaceIntPair)*10>::type p
|
||||
|
||||
static EmplaceIntPair* initialize_emplace_int_pair()
|
||||
{
|
||||
EmplaceIntPair* ret = reinterpret_cast<EmplaceIntPair*>(&pair_storage);
|
||||
EmplaceIntPair* ret = move_detail::force_ptr<EmplaceIntPair*>(&pair_storage);
|
||||
for(unsigned int i = 0; i != 10; ++i){
|
||||
new(&ret->first)EmplaceInt();
|
||||
new(&ret->second)EmplaceInt();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <boost/container/detail/algorithm.hpp> //equal()
|
||||
#include "movable_int.hpp"
|
||||
#include <boost/move/make_unique.hpp>
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
|
||||
namespace boost { namespace container { namespace test {
|
||||
|
||||
@ -85,7 +86,7 @@ bool test_insert_with_expand_bwd()
|
||||
{
|
||||
boost::movelib::unique_ptr<char[]> memptr =
|
||||
boost::movelib::make_unique_definit<char[]>(MemorySize*sizeof(value_type));
|
||||
value_type *memory = (value_type*)memptr.get();
|
||||
value_type *memory = move_detail::force_ptr<value_type*>(memptr.get());
|
||||
std::vector<value_type> initial_data;
|
||||
initial_data.resize(InitialSize[iteration]);
|
||||
for(unsigned int i = 0; i < InitialSize[iteration]; ++i){
|
||||
@ -148,7 +149,7 @@ bool test_assign_with_expand_bwd()
|
||||
{
|
||||
boost::movelib::unique_ptr<char[]> memptr =
|
||||
boost::movelib::make_unique_definit<char[]>(MemorySize*sizeof(value_type));
|
||||
value_type *memory = (value_type*)memptr.get();
|
||||
value_type *memory = move_detail::force_ptr<value_type*>(memptr.get());
|
||||
//Create initial data
|
||||
std::vector<value_type> initial_data;
|
||||
initial_data.resize(InitialSize[iteration]);
|
||||
|
@ -22,6 +22,7 @@ volatile ::boost::container::vector<empty> dummy;
|
||||
#include <boost/container/allocator.hpp>
|
||||
#include "movable_int.hpp"
|
||||
#include "dummy_test_allocator.hpp"
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
|
||||
class CustomAllocator
|
||||
{
|
||||
@ -33,7 +34,7 @@ class CustomAllocator
|
||||
typedef short difference_type;
|
||||
|
||||
pointer allocate(size_type count)
|
||||
{ return (pointer)new char[sizeof(value_type)*count]; }
|
||||
{ return boost::move_detail::force_ptr<pointer>(new char[sizeof(value_type)*count]); }
|
||||
|
||||
void deallocate(pointer ptr, size_type )
|
||||
{ delete [](char*)ptr; }
|
||||
|
Reference in New Issue
Block a user