pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.04k stars 2.11k forks source link

Allow ADL for swapping Optional values #4569

Closed joukewitteveen closed 2 weeks ago

joukewitteveen commented 1 month ago

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.