template definition, for example ... translates to ...
To close. It actually means:
template<typename I, typename O, int a_unique_name = 42, typename std::enable_if <a_unique_name == 43 || (InputIterator<I>() && WeaklyIncrementable<O>()), int>::type = 0 > void fun_signature() {}
A unique int name exists to ensure that the condition for enable_if dependent on the template parameter to exclude the condition being checked during template definition and not during instance creation so that SFINAE can happen. Consider this class definition:
template<class T> struct S { template<class U, CONCEPT_REQUIRES_(ranges::Integral<T>())> void f(U); };
without an injected unique int , this definition will be lower:
template<class T> struct S { template<class U, std::enable_if_t<ranges::Integral<T>()>> void f(U); };
and since ranges::Integral<T>() is independent of the template parameter of this function, compilers will diagnose that std::enable_if_t<ranges::Integral<T>()> - which drops to typename std::enable_if<ranges::Integral<T>()>::type is poorly formed because std::enable_if<false> does not contain a member named type , With injected-unique- int , the class definition is reduced to:
template<class T> struct S { template<class U, int some_unique_name = 42, std::enable_if_t<some_unique_name == 43 || ranges::Integral<T>()>> void f(U); };
now the compiler cannot analyze enable_if_t during template definition, since some_unique_name is a template parameter that the user can specify as 43 .
Casey source share