mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 02:25:52 +00:00
Use new instead of ::new for placement
This commit is contained in:
@@ -94,7 +94,7 @@ struct SharedHandlerAllocator
|
||||
|
||||
void construct (pointer p, const_reference val) const
|
||||
{
|
||||
::new ((void *)p) value_type (val);
|
||||
new ((void *)p) value_type (val);
|
||||
}
|
||||
|
||||
void destroy (pointer p) const
|
||||
|
||||
@@ -97,18 +97,6 @@ protected:
|
||||
deallocate <Handler> (shared, size, local);
|
||||
}
|
||||
|
||||
// If these somehow get called, bad things will happen
|
||||
//
|
||||
void* operator new (std::size_t)
|
||||
{
|
||||
return pure_virtual_called (__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void operator delete (void*)
|
||||
{
|
||||
return pure_virtual_called (__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
protected:
|
||||
std::size_t const m_size;
|
||||
Handler mutable m_handler;
|
||||
@@ -218,7 +206,7 @@ Container <Handler>* newSharedHandlerContainer (BOOST_ASIO_MOVE_ARG(Handler) han
|
||||
Handler local (BOOST_ASIO_MOVE_CAST(Handler)(handler));
|
||||
void* const p (boost_asio_handler_alloc_helpers::
|
||||
allocate <Handler> (size, local));
|
||||
return ::new (p) ContainerType (size, BOOST_ASIO_MOVE_CAST(Handler)(local));
|
||||
return new (p) ContainerType (size, BOOST_ASIO_MOVE_CAST(Handler)(local));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -618,48 +618,48 @@ public:
|
||||
|
||||
iterator push_back (TParam value)
|
||||
{
|
||||
::new (alloc ()) T (value);
|
||||
new (alloc ()) T (value);
|
||||
return iterator (this, size () - 1);
|
||||
}
|
||||
|
||||
iterator emplace_back ()
|
||||
{
|
||||
::new (alloc ()) T ();
|
||||
new (alloc ()) T ();
|
||||
return iterator (this, size () - 1);
|
||||
}
|
||||
|
||||
template <class A1>
|
||||
iterator emplace_back (A1 a1)
|
||||
{
|
||||
::new (alloc ()) T (a1);
|
||||
new (alloc ()) T (a1);
|
||||
return iterator (this, size () - 1);
|
||||
}
|
||||
|
||||
template <class A1, class A2>
|
||||
iterator emplace_back (A1 a1, A2 a2)
|
||||
{
|
||||
::new (alloc ()) T (a1, a2);
|
||||
new (alloc ()) T (a1, a2);
|
||||
return iterator (this, size () - 1);
|
||||
}
|
||||
|
||||
template <class A1, class A2, class A3>
|
||||
iterator emplace_back (A1 a1, A2 a2, A3 a3)
|
||||
{
|
||||
::new (alloc ()) T (a1, a2, a3);
|
||||
new (alloc ()) T (a1, a2, a3);
|
||||
return iterator (this, size () - 1);
|
||||
}
|
||||
|
||||
template <class A1, class A2, class A3, class A4>
|
||||
iterator emplace_back (A1 a1, A2 a2, A3 a3, A4 a4)
|
||||
{
|
||||
::new (alloc ()) T (a1, a2, a3, a4);
|
||||
new (alloc ()) T (a1, a2, a3, a4);
|
||||
return iterator (this, size () - 1);
|
||||
}
|
||||
|
||||
template <class A1, class A2, class A3, class A4, class A5>
|
||||
iterator emplace_back (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
|
||||
{
|
||||
::new (alloc ()) T (a1, a2, a3, a4, a5);
|
||||
new (alloc ()) T (a1, a2, a3, a4, a5);
|
||||
return iterator (this, size () - 1);
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ public:
|
||||
void resize (size_type count)
|
||||
{
|
||||
while (count > size ())
|
||||
::new (alloc ()) T;
|
||||
new (alloc ()) T;
|
||||
|
||||
while (count < size ())
|
||||
get (--m_size).~T ();
|
||||
@@ -680,7 +680,7 @@ public:
|
||||
void resize (size_type count, TParam value)
|
||||
{
|
||||
while (count > size ())
|
||||
::new (alloc ()) T (value);
|
||||
new (alloc ()) T (value);
|
||||
|
||||
while (count < size ())
|
||||
get (--m_size).~T ();
|
||||
|
||||
@@ -367,43 +367,43 @@ public:
|
||||
*/
|
||||
iterator emplace_back ()
|
||||
{
|
||||
return iterator_to (*::new (alloc ()->get ()) T ());
|
||||
return iterator_to (*new (alloc ()->get ()) T ());
|
||||
}
|
||||
|
||||
template <class A1>
|
||||
iterator emplace_back (A1 a1)
|
||||
{
|
||||
return iterator_to (*::new (alloc ()->get ()) T (a1));
|
||||
return iterator_to (*new (alloc ()->get ()) T (a1));
|
||||
}
|
||||
|
||||
template <class A1, class A2>
|
||||
iterator emplace_back (A1 a1, A2 a2)
|
||||
{
|
||||
return iterator_to (*::new (alloc ()->get ()) T (a1, a2));
|
||||
return iterator_to (*new (alloc ()->get ()) T (a1, a2));
|
||||
}
|
||||
|
||||
template <class A1, class A2, class A3>
|
||||
iterator emplace_back (A1 a1, A2 a2, A3 a3)
|
||||
{
|
||||
return iterator_to (*::new (alloc ()->get ()) T (a1, a2, a3));
|
||||
return iterator_to (*new (alloc ()->get ()) T (a1, a2, a3));
|
||||
}
|
||||
|
||||
template <class A1, class A2, class A3, class A4>
|
||||
iterator emplace_back (A1 a1, A2 a2, A3 a3, A4 a4)
|
||||
{
|
||||
return iterator_to (*::new (alloc ()->get ()) T (a1, a2, a3, a4));
|
||||
return iterator_to (*new (alloc ()->get ()) T (a1, a2, a3, a4));
|
||||
}
|
||||
|
||||
template <class A1, class A2, class A3, class A4, class A5>
|
||||
iterator emplace_back (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
|
||||
{
|
||||
return iterator_to (*::new (alloc ()->get ()) T (a1, a2, a3, a4, a5));
|
||||
return iterator_to (*new (alloc ()->get ()) T (a1, a2, a3, a4, a5));
|
||||
}
|
||||
|
||||
/** Allocate a new copy-constructed element and return the index. */
|
||||
iterator push_back (TParam value) noexcept
|
||||
{
|
||||
return iterator_to (*::new (alloc ()->get ()) T (value));
|
||||
return iterator_to (*new (alloc ()->get ()) T (value));
|
||||
}
|
||||
|
||||
/** Erase the element at the specified position. */
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
template <typename F>
|
||||
SharedFunction (F f, A a = A ())
|
||||
: m_ptr (::new (
|
||||
: m_ptr (new (
|
||||
typename CallType <F>::Allocator (a)
|
||||
.allocate (sizeof (CallType <F>)))
|
||||
CallType <F> (BEAST_MOVE_CAST(F)(f), a))
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
|
||||
template <typename F>
|
||||
SharedFunction (F f, A a = A ())
|
||||
: m_ptr (::new (
|
||||
: m_ptr (new (
|
||||
typename CallType <F>::Allocator (a)
|
||||
.allocate (sizeof (CallType <F>)))
|
||||
CallType <F> (BEAST_MOVE_CAST(F)(f), a))
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
{
|
||||
bassert (lifetime == SingletonLifetime::createOnDemand || ! staticData.destructorCalled);
|
||||
staticData.instance = &staticData.object;
|
||||
::new (staticData.instance) SharedSingleton (lifetime);
|
||||
new (staticData.instance) SharedSingleton (lifetime);
|
||||
instance = staticData.instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
if (staticData.state.compareAndSetBool (initializing, uninitialized))
|
||||
{
|
||||
// Initialize the object.
|
||||
::new (&staticData.object) Object;
|
||||
new (&staticData.object) Object;
|
||||
staticData.state = initialized;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -50,7 +50,7 @@ TrackedMutexBasics::PerThreadData& TrackedMutexBasics::getPerThreadData ()
|
||||
// Manually call the constructor with placement new if needed
|
||||
if (! thread.id)
|
||||
{
|
||||
::new (&thread) PerThreadData ();
|
||||
new (&thread) PerThreadData ();
|
||||
bassert (thread.id != 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user