On 01/18/2014 03:50 AM, Stanislav Blinov wrote:
Oh, I see now where it went the wrong way. From my own example, of
course :)
Surely I was meaning:
class Careful(T) {
//...
void thisIsSoPolymorphic() nothrow(isNoThrow!(T.foo)) { ... }
//...
}
Something to that extent. So that yes, the function itself is not a
template.
Well, but it will be annotated nothrow anyway if possible. Inference is
not actually limited in the implied way.
In case you _really_ want to be explicit about this (and you seem not
to), the general problem precluding a nice library implementation is
that built-in attributes cannot be aliased.
You can always use a string mixin though:
mixin(`void thisIsSoPolymorphic()`~(isNoThrow!(T.foo)?:"nothrow":"")~q{{
...
}});
This easily scales to all attributes you may find interesting:
mixin(`void thisIsSoPolymorphic()`~stringOfAttributes!(T.foo)~q{{
...
}});