Fix SFINAE on gsl::owner. (#1174)

`std::enable_if_t` must not be used as a default template argument, otherwise the instantiator will be able to override it freely with something that doesn't fail substitution. Instead, `std::enable_if_t` itself must be the type of the template argument.

More information in the examples here: https://en.cppreference.com/w/cpp/types/enable_if
This commit is contained in:
Alberto La Rocca 2024-12-13 16:56:28 +01:00 committed by GitHub
parent 4b190d2e2a
commit aed09c41b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,7 +75,7 @@ using std::unique_ptr;
// T must be a pointer type // T must be a pointer type
// - disallow construction from any type other than pointer type // - disallow construction from any type other than pointer type
// //
template <class T, class = std::enable_if_t<std::is_pointer<T>::value>> template <class T, std::enable_if_t<std::is_pointer<T>::value, bool> = true>
using owner = T; using owner = T;
// //