mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
Tidy up calls to placement new
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
Version 196:
|
||||
|
||||
* Tidy up calls to placement new
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 195:
|
||||
|
||||
* net is a namespace alias for boost::asio
|
||||
|
@ -181,7 +181,7 @@ alloc(std::size_t n)
|
||||
if(end >= buf_ && end +
|
||||
sizeof(element) + n <= buf_ + size_)
|
||||
{
|
||||
auto& e = *new(end) element{n, used};
|
||||
auto& e = *::new(end) element{n, used};
|
||||
list_.push_back(e);
|
||||
high_ = (std::max)(high_, used);
|
||||
return e.data();
|
||||
@ -300,7 +300,8 @@ public:
|
||||
void
|
||||
construct(U* ptr, Args&&... args)
|
||||
{
|
||||
::new((void*)ptr) U(std::forward<Args>(args)...);
|
||||
::new(static_cast<void*>(ptr)) U(
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<class U>
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
construct(std::size_t size)
|
||||
{
|
||||
auto p = new char[sizeof(static_pool) + size];
|
||||
return *(new(p) static_pool{size});
|
||||
return *(::new(p) static_pool{size});
|
||||
}
|
||||
|
||||
static_pool&
|
||||
@ -169,7 +169,8 @@ public:
|
||||
void
|
||||
construct(U* ptr, Args&&... args)
|
||||
{
|
||||
::new((void*)ptr) U(std::forward<Args>(args)...);
|
||||
::new(static_cast<void*>(ptr)) U(
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<class U>
|
||||
|
@ -1168,7 +1168,7 @@ new_element(field name,
|
||||
auto const p = alloc_traits::allocate(a,
|
||||
(sizeof(element) + off + len + 2 + sizeof(align_type) - 1) /
|
||||
sizeof(align_type));
|
||||
return *(new(p) element(name, sname, value));
|
||||
return *(::new(p) element(name, sname, value));
|
||||
}
|
||||
|
||||
template<class Allocator>
|
||||
|
@ -276,7 +276,7 @@ private:
|
||||
16, sizeof(prng_type));
|
||||
if(! p)
|
||||
BOOST_THROW_EXCEPTION(std::bad_alloc{});
|
||||
return *(new(p) prng_type(seed(), n_++));
|
||||
return *(::new(p) prng_type(seed(), n_++));
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user