Why is unique_ptr not equality_comparable_with nullptr_t in C++20?
46
4
Working with C++20's concept s I noticed that std::unique_ptr appears to fail to satisfy the std::equality_comparable_with<std::nullptr_t,...> concept. From std::unique_ptr 's definition, it is supposed to implement the following when in C++20: template<class T1, class D1, class T2, class D2> bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); template <class T, class D> bool operator==(const unique_ptr<T, D>& x, std::nullptr_t) noexcept; This requirement should implement symmetric comparison with nullptr -- which from my understanding is sufficient for satisfying equality_comparable_with . Curiously, this issue appears to be consistent on all the major compilers. The following c...