On 11.01.21 16:27, Marcone via Digitalmars-d-learn wrote:
function [...] without template.

And why don't you want to use templates for that? It's as easy as that:

import std;

auto foo(T)(T tup) if (isTuple!T) {
    // statically introspect tuple here ...
    return tup;
}

void main()
{
    writeln(foo(tuple(1, "2", '3')));
    writeln(foo(tuple()));
    //writeln(foo("not a tuple")); // fails to compile
}

[1] https://run.dlang.io/is/VYk9Y9

Reply via email to