parameter type tuple or alias for std.traits templates ?

Guillaume Chatelet chatelet.guillaume at gmail.com
Fri Jun 22 14:50:27 PDT 2012


While reading the source code of std.traits I came across a bunch of
variadic templates enforcing the length of their parameter type tuple to
be of 1.

Is there any semantic difference between
> template ReturnType(func...) if (func.length == 1 && isCallable!func)
and
> template ReturnType(alias func) if (isCallable!func)

If not, is there any reason why this syntax is used ?

Guillaume
--
The list of templates from std.traits (
https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d )
matching this pattern :

template ReturnType(func...)
 if (func.length == 1 && isCallable!func)

template ParameterTypeTuple(func...)
 if (func.length == 1 && isCallable!func)

template ParameterStorageClassTuple(func...)
 if (func.length == 1 && isCallable!func)

template functionAttributes(func...)
 if (func.length == 1 && isCallable!func)

template functionLinkage(func...)
 if (func.length == 1 && isCallable!func)

template variadicFunctionStyle(func...)
 if (func.length == 1 && isCallable!func)

template FunctionTypeOf(func...)
 if (func.length == 1 && isCallable!func)

template isFunctionPointer(T...)
 if (T.length == 1)

template isDelegate(T...)
 if(T.length == 1)

template isSomeFunction(T...)
 if (T.length == 1)

template isCallable(T...)
 if (T.length == 1)

template isAbstractFunction(method...)
 if (method.length == 1)

template mangledName(sth...)
 if (sth.length == 1)


More information about the Digitalmars-d mailing list