xxxxxxxxxx
import std;
// Your code
Algebraic!T parse(T...)(string s)
{
foreach(t; T)
{
try
return Algebraic!T(to!t(s));
catch (Exception e)
{ }
}
assert(0);
}
alias TypesMap = AliasSeq!(
"-p", Tuple!(int, string),
"--name", Tuple!string,
"-h", Tuple!float
);
alias AllowedTypes(string Param) = RepresentationTypeTuple!(TypesMap[staticIndexOf!(Param, TypesMap)+1]);
void main()
{
parse!(AllowedTypes!"-p")("asd").writeln;
parse!(AllowedTypes!"-h")("3.1").writeln;
}