mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 06:55:50 +00:00
Use deleted members to prevent copying in Beast (RIPD-268)
This commit is contained in:
committed by
Vinnie Falco
parent
cd97b5beec
commit
60330da25c
@@ -55,7 +55,7 @@ namespace beast
|
||||
@endcode
|
||||
*/
|
||||
template <class ObjectType>
|
||||
class LinkedListPointer : public Uncopyable
|
||||
class LinkedListPointer
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
@@ -65,6 +65,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
LinkedListPointer(LinkedListPointer const&) = delete;
|
||||
LinkedListPointer& operator= (LinkedListPointer const&) = delete;
|
||||
|
||||
/** Creates a pointer to a list whose head is the item provided. */
|
||||
explicit LinkedListPointer (ObjectType* const headItem) noexcept
|
||||
: item (headItem)
|
||||
@@ -332,7 +335,7 @@ public:
|
||||
list, and then repeatedly call Appender::append() to add items to the end
|
||||
of the list in O(1) time.
|
||||
*/
|
||||
class Appender : public Uncopyable
|
||||
class Appender
|
||||
{
|
||||
public:
|
||||
/** Creates an appender which will add items to the given list.
|
||||
@@ -344,6 +347,9 @@ public:
|
||||
bassert (endOfListPointer.item == nullptr);
|
||||
}
|
||||
|
||||
Appender(LinkedListPointer const&) = delete;
|
||||
Appender& operator= (Appender const&) = delete;
|
||||
|
||||
/** Appends an item to the list. */
|
||||
void append (ObjectType* const newItem) noexcept
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace beast
|
||||
|
||||
*/
|
||||
template <typename ValueType>
|
||||
class ScopedValueSetter : public Uncopyable
|
||||
class ScopedValueSetter
|
||||
{
|
||||
public:
|
||||
/** Creates a ScopedValueSetter that will immediately change the specified value to the
|
||||
@@ -80,6 +80,9 @@ public:
|
||||
valueToSet = newValue;
|
||||
}
|
||||
|
||||
ScopedValueSetter(ScopedValueSetter const&) = delete;
|
||||
ScopedValueSetter& operator= (ScopedValueSetter const&) = delete;
|
||||
|
||||
~ScopedValueSetter()
|
||||
{
|
||||
value = originalValue;
|
||||
|
||||
Reference in New Issue
Block a user