diff --git a/include/boost/container/detail/advanced_insert_int.hpp b/include/boost/container/detail/advanced_insert_int.hpp index fc8a33a..17ceb01 100644 --- a/include/boost/container/detail/advanced_insert_int.hpp +++ b/include/boost/container/detail/advanced_insert_int.hpp @@ -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::value>::type stor; - value_type &v = *static_cast(static_cast(stor.data)); - alloc_traits::construct(a, &v); - value_destructor on_exit(a, v); (void)on_exit; - *p = ::boost::move(v); + typename aligned_storage::value>::type v; + value_type *vp = reinterpret_cast(v.data); + alloc_traits::construct(a, vp); + value_destructor 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){ for (; 0 < n; --n, ++p){ - typename aligned_storage::value>::type stor; - value_type &v = *static_cast(static_cast(stor.data)); - alloc_traits::construct(a, &v, default_init); - value_destructor on_exit(a, v); (void)on_exit; - *p = ::boost::move(v); + typename aligned_storage::value>::type v; + value_type *vp = reinterpret_cast(v.data); + alloc_traits::construct(a, vp, default_init); + value_destructor 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::value>::type v; - value_type *vp = static_cast(static_cast(v.data)); + value_type *vp = reinterpret_cast(v.data); alloc_traits::construct(a, vp, ::boost::forward(get(this->args_))...); BOOST_TRY{ @@ -400,7 +400,7 @@ struct insert_emplace_proxy_arg##N\ BOOST_ASSERT(n == 1); (void)n;\ typename aligned_storage::value>::type v;\ BOOST_ASSERT((((size_type)(&v)) % alignment_of::value) == 0);\ - value_type *vp = static_cast(static_cast(v.data));\ + value_type *vp = reinterpret_cast(v.data);\ alloc_traits::construct(a, vp BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ BOOST_TRY{\ *p = ::boost::move(*vp);\