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