mirror of
https://github.com/boostorg/container.git
synced 2025-08-01 21:44:27 +02:00
Fix some type punning warnings, avoiding forming a reference to non-constructed objects
This commit is contained in:
@@ -128,11 +128,11 @@ struct insert_value_initialized_n_proxy
|
||||
void copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
{
|
||||
for (; 0 < n; --n, ++p){
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type stor;
|
||||
value_type &v = *static_cast<value_type *>(static_cast<void *>(stor.data));
|
||||
alloc_traits::construct(a, &v);
|
||||
value_destructor<Allocator> on_exit(a, v); (void)on_exit;
|
||||
*p = ::boost::move(v);
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);
|
||||
alloc_traits::construct(a, vp);
|
||||
value_destructor<Allocator> on_exit(a, *vp); (void)on_exit;
|
||||
*p = ::boost::move(*vp);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -151,11 +151,11 @@ struct insert_default_initialized_n_proxy
|
||||
{
|
||||
if(!is_pod<value_type>::value){
|
||||
for (; 0 < n; --n, ++p){
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type stor;
|
||||
value_type &v = *static_cast<value_type *>(static_cast<void *>(stor.data));
|
||||
alloc_traits::construct(a, &v, default_init);
|
||||
value_destructor<Allocator> on_exit(a, v); (void)on_exit;
|
||||
*p = ::boost::move(v);
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
|
||||
value_type *vp = reinterpret_cast<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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,7 +289,7 @@ struct insert_emplace_proxy
|
||||
{
|
||||
BOOST_ASSERT(n ==1); (void)n;
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
|
||||
value_type *vp = static_cast<value_type *>(static_cast<void *>(v.data));
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);
|
||||
alloc_traits::construct(a, vp,
|
||||
::boost::forward<Args>(get<IdxPack>(this->args_))...);
|
||||
BOOST_TRY{
|
||||
@@ -400,7 +400,7 @@ struct insert_emplace_proxy_arg##N\
|
||||
BOOST_ASSERT(n == 1); (void)n;\
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\
|
||||
BOOST_ASSERT((((size_type)(&v)) % alignment_of<value_type>::value) == 0);\
|
||||
value_type *vp = static_cast<value_type *>(static_cast<void *>(v.data));\
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);\
|
||||
alloc_traits::construct(a, vp BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\
|
||||
BOOST_TRY{\
|
||||
*p = ::boost::move(*vp);\
|
||||
|
Reference in New Issue
Block a user