mirror of
https://github.com/pocoproject/poco.git
synced 2025-07-03 01:05:21 +02:00
Allow ADL for swapping Optional values (#4569)
Some types support being swapped but may not have declared their std::swap overloads when Poco/Optional.h is first included. This is the case for instance with #include <Poco/Optional.h> #include <array> using Problematic = Poco::Optional<std::array<int, 42> >; With an unqualified call to swap, preceded by using std::swap, we allow argument-dependent lookup to find suitable implementations of swap.
This commit is contained in:
parent
c6249d9b3f
commit
e00b4de672
@ -143,8 +143,9 @@ public:
|
|||||||
|
|
||||||
void swap(Optional& other) noexcept
|
void swap(Optional& other) noexcept
|
||||||
{
|
{
|
||||||
std::swap(_value, other._value);
|
using std::swap;
|
||||||
std::swap(_isSpecified, other._isSpecified);
|
swap(_value, other._value);
|
||||||
|
swap(_isSpecified, other._isSpecified);
|
||||||
}
|
}
|
||||||
|
|
||||||
const C& value() const
|
const C& value() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user