1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Created c++11 move constructors and operator= methods for a bunch of classes (only enabled for c++11 compilers, of course)

This commit is contained in:
Julian Storer 2011-08-21 21:20:28 +01:00
parent 2c328dfedc
commit ffc2f5d40e
46 changed files with 629 additions and 39 deletions

View file

@ -122,6 +122,19 @@ Value& Value::operator= (const Value& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
Value::Value (Value&& other) noexcept
: value (static_cast <ReferenceCountedObjectPtr <ValueSource>&&> (other.value))
{
}
Value& Value::operator= (Value&& other) noexcept
{
value = static_cast <ReferenceCountedObjectPtr <ValueSource>&&> (other.value);
return *this;
}
#endif
Value::~Value()
{
if (listeners.size() > 0)

View file

@ -60,6 +60,11 @@ public:
/** Creates a Value that is set to the specified value. */
explicit Value (const var& initialValue);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
Value (Value&& other) noexcept;
Value& operator= (Value&& other) noexcept;
#endif
/** Destructor. */
~Value();

View file

@ -605,6 +605,19 @@ ValueTree& ValueTree::operator= (const ValueTree& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
ValueTree::ValueTree (ValueTree&& other) noexcept
: object (static_cast <SharedObjectPtr&&> (other.object))
{
}
ValueTree& ValueTree::operator= (ValueTree&& other) noexcept
{
object = static_cast <SharedObjectPtr&&> (other.object);
return *this;
}
#endif
ValueTree::~ValueTree()
{
if (listeners.size() > 0 && object != nullptr)

View file

@ -91,6 +91,11 @@ public:
/** Makes this object reference another node. */
ValueTree& operator= (const ValueTree& other);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
ValueTree (ValueTree&& other) noexcept;
ValueTree& operator= (ValueTree&& other) noexcept;
#endif
/** Destructor. */
~ValueTree();