https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99985

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We can still make it short circuit (and so not instantiate class templates
unnecessarily) like this:

#if __cplusplus <= 201402L
          return __and_<__bool_constant<_No_realloc>,
                 is_nothrow_copy_constructible<_Hash>,
                 is_nothrow_copy_constructible<_Equal>>::value;
#else
          if constexpr (_No_realloc)
            if constexpr (is_nothrow_copy_constructible<_Hash>())
              return is_nothrow_copy_constructible<_Equal>();
          return false;
#endif

I didn't use __and_<> because that has to be instantiated too (although it's
cheaper than the is_xxx_constructible ones), and for C++17 the if-constexpr
version avoids that. But if we need a #if to work for C++11 anyway, we might as
well use __and_ for C++11 and C++14, and if-constexpr for everything later.

Reply via email to