mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Mark some move and move-assignment ctors noexcept
This commit is contained in:
@@ -82,7 +82,7 @@ public:
|
||||
/** Move-construct.
|
||||
The other buffer is reset.
|
||||
*/
|
||||
Buffer (Buffer&& other)
|
||||
Buffer (Buffer&& other) noexcept
|
||||
: p_ (std::move(other.p_))
|
||||
, size_ (other.size_)
|
||||
{
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
/** Move-assign.
|
||||
The other buffer is reset.
|
||||
*/
|
||||
Buffer& operator= (Buffer&& other)
|
||||
Buffer& operator= (Buffer&& other) noexcept
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace ripple {
|
||||
class CountedObjects
|
||||
{
|
||||
public:
|
||||
static CountedObjects& getInstance ();
|
||||
static CountedObjects& getInstance () noexcept;
|
||||
|
||||
using Entry = std::pair <std::string, int>;
|
||||
using List = std::vector <Entry>;
|
||||
@@ -46,9 +46,9 @@ public:
|
||||
class CounterBase
|
||||
{
|
||||
public:
|
||||
CounterBase ();
|
||||
CounterBase () noexcept;
|
||||
|
||||
virtual ~CounterBase ();
|
||||
virtual ~CounterBase () noexcept;
|
||||
|
||||
int increment () noexcept
|
||||
{
|
||||
@@ -81,8 +81,8 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
CountedObjects ();
|
||||
~CountedObjects () = default;
|
||||
CountedObjects () noexcept;
|
||||
~CountedObjects () noexcept = default;
|
||||
|
||||
private:
|
||||
std::atomic <int> m_count;
|
||||
@@ -102,19 +102,19 @@ template <class Object>
|
||||
class CountedObject
|
||||
{
|
||||
public:
|
||||
CountedObject ()
|
||||
CountedObject () noexcept
|
||||
{
|
||||
getCounter ().increment ();
|
||||
}
|
||||
|
||||
CountedObject (CountedObject const&)
|
||||
CountedObject (CountedObject const&) noexcept
|
||||
{
|
||||
getCounter ().increment ();
|
||||
}
|
||||
|
||||
CountedObject& operator=(CountedObject const&) = default;
|
||||
CountedObject& operator=(CountedObject const&) noexcept = default;
|
||||
|
||||
~CountedObject ()
|
||||
~CountedObject () noexcept
|
||||
{
|
||||
getCounter ().decrement ();
|
||||
}
|
||||
@@ -123,7 +123,7 @@ private:
|
||||
class Counter : public CountedObjects::CounterBase
|
||||
{
|
||||
public:
|
||||
Counter () { }
|
||||
Counter () noexcept { }
|
||||
|
||||
char const* getName () const override
|
||||
{
|
||||
@@ -134,8 +134,9 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
static Counter& getCounter()
|
||||
static Counter& getCounter() noexcept
|
||||
{
|
||||
static_assert(std::is_nothrow_constructible<Counter>{}, "");
|
||||
static Counter c;
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -18,17 +18,18 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/basics/CountedObject.h>
|
||||
#include <type_traits>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
CountedObjects& CountedObjects::getInstance ()
|
||||
CountedObjects& CountedObjects::getInstance () noexcept
|
||||
{
|
||||
static CountedObjects instance;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
CountedObjects::CountedObjects ()
|
||||
CountedObjects::CountedObjects () noexcept
|
||||
: m_count (0)
|
||||
, m_head (nullptr)
|
||||
{
|
||||
@@ -66,7 +67,7 @@ CountedObjects::List CountedObjects::getCounts (int minimumThreshold) const
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
CountedObjects::CounterBase::CounterBase ()
|
||||
CountedObjects::CounterBase::CounterBase () noexcept
|
||||
: m_count (0)
|
||||
{
|
||||
// Insert ourselves at the front of the lock-free linked list
|
||||
@@ -84,7 +85,7 @@ CountedObjects::CounterBase::CounterBase ()
|
||||
++instance.m_count;
|
||||
}
|
||||
|
||||
CountedObjects::CounterBase::~CounterBase ()
|
||||
CountedObjects::CounterBase::~CounterBase () noexcept
|
||||
{
|
||||
// VFALCO NOTE If the counters are destroyed before the singleton,
|
||||
// undefined behavior will result if the singleton's member
|
||||
|
||||
@@ -117,9 +117,9 @@ public:
|
||||
};
|
||||
|
||||
qalloc_type (qalloc_type const&) = default;
|
||||
qalloc_type (qalloc_type&& other) = default;
|
||||
qalloc_type (qalloc_type&& other) noexcept = default;
|
||||
qalloc_type& operator= (qalloc_type const&) = default;
|
||||
qalloc_type& operator= (qalloc_type&&) = default;
|
||||
qalloc_type& operator= (qalloc_type&&) noexcept = default;
|
||||
|
||||
qalloc_type();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user