Use deleted members to prevent copying in Beast (RIPD-268)

This commit is contained in:
Nik Bougalis
2014-09-25 11:13:38 -07:00
committed by Vinnie Falco
parent cd97b5beec
commit 60330da25c
48 changed files with 255 additions and 191 deletions

View File

@@ -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
{

View File

@@ -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;