Namespaces
Variants
Views
Actions

Talk:cpp/container/array/swap

From cppreference.com

Should the noexcept specifier of array::swap in the version until C++17 depend on std::swap(std::declval<T&>(), std::declval<T&>()) or just swap(std::declval<T&>(), std::declval<T&>()) (without the std:: before swap)? GCC 5 uses swap, not std::swap. Irgendwhy (talk) 14:45, 4 January 2017 (PST)

This is a tricky one. The version without `std::` is actually ill-formed - the lookup for swap finds the member swap and stops there (see LWG issue 2456). Clang even has a special hack just for libstdc++ headers doing this. However, the `std::` version isn't right either because it suggests the absence of ADL. T. Canens (talk) 15:29, 4 January 2017 (PST)