On Mon, Apr 5, 2010 at 12:52, Philippe Sigaud <philippe.sigaud@gmail.com> wrote:
That's useful to compare two functions:
template sameArgs(alias fun1, alias fun2) {
static if (compare!(ParameterTypeTuple!fun1, ParameterTypeTuple!fun2))
Ugh, forget this example, in this case we know the original tuples, so == is simpler and cleaner.
Another interesting thing to test is if one typetuple can be converted into another.
Maybe like this:
bool compatibleTypeTuples(TT...) {
TT[0..$/2] tt1;
TT[$/2..$] tt2;
static if (__traits(compiles, tt1 = tt2))
return true;
else
return false;
}