static foreach considered
Daniel N via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 16 13:39:43 PDT 2015
On Monday, 8 June 2015 at 20:02:11 UTC, Andrei Alexandrescu wrote:
> I'm trying to collect together motivating examples and to
> figure out the semantics of the feature.
>
>
> Andrei
Could something like this fly?
struct weird
{
void xxx()(T val) if(T.sizeof <= 8);
void xxx()(const auto ref T val) if(T.sizeof > 8);
// would require something similar to getOverloads but for
templates...?
static foreach(decl; __traits(getTemplates, typeof(this),
"xxx"))
{
// impl xxx only once
}
}
Or is there a better way to accomplish the above?
Daniel
More information about the Digitalmars-d
mailing list