mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 11:06:50 +01:00
additional move support for Nullable and Optional
This commit is contained in:
@@ -82,6 +82,14 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Nullable(C&& value):
|
||||||
|
/// Creates a Nullable by moving the given value.
|
||||||
|
_value(value),
|
||||||
|
_isNull(false),
|
||||||
|
_null()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Nullable(const Nullable& other):
|
Nullable(const Nullable& other):
|
||||||
/// Creates a Nullable by copying another one.
|
/// Creates a Nullable by copying another one.
|
||||||
_value(other._value),
|
_value(other._value),
|
||||||
@@ -112,6 +120,14 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Nullable& assign(C&& value)
|
||||||
|
/// Assigns a value to the Nullable.
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
_isNull = false;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
Nullable& assign(const Nullable& other)
|
Nullable& assign(const Nullable& other)
|
||||||
/// Assigns another Nullable.
|
/// Assigns another Nullable.
|
||||||
{
|
{
|
||||||
@@ -133,6 +149,12 @@ public:
|
|||||||
return assign(value);
|
return assign(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Nullable& operator = (C&& value)
|
||||||
|
/// Move-assigns a value to the Nullable.
|
||||||
|
{
|
||||||
|
return assign(value);
|
||||||
|
}
|
||||||
|
|
||||||
Nullable& operator = (const Nullable& other)
|
Nullable& operator = (const Nullable& other)
|
||||||
/// Assigns another Nullable.
|
/// Assigns another Nullable.
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional(C&& value):
|
||||||
|
/// Creates a Optional by moving the given value.
|
||||||
|
_value(value),
|
||||||
|
_isSpecified(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Optional(const Optional& other):
|
Optional(const Optional& other):
|
||||||
/// Creates a Optional by copying another one.
|
/// Creates a Optional by copying another one.
|
||||||
_value(other._value),
|
_value(other._value),
|
||||||
@@ -90,7 +97,15 @@ public:
|
|||||||
Optional& assign(const C& value)
|
Optional& assign(const C& value)
|
||||||
/// Assigns a value to the Optional.
|
/// Assigns a value to the Optional.
|
||||||
{
|
{
|
||||||
_value = value;
|
_value = value;
|
||||||
|
_isSpecified = true;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Optional& assign(C&& value)
|
||||||
|
/// Moves a value into the Optional.
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
_isSpecified = true;
|
_isSpecified = true;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -108,6 +123,11 @@ public:
|
|||||||
return assign(value);
|
return assign(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional& operator = (C&& value)
|
||||||
|
{
|
||||||
|
return assign(value);
|
||||||
|
}
|
||||||
|
|
||||||
Optional& operator = (const Optional& other)
|
Optional& operator = (const Optional& other)
|
||||||
{
|
{
|
||||||
return assign(other);
|
return assign(other);
|
||||||
|
|||||||
Reference in New Issue
Block a user