Optional tags and attributes
Stanislav Blinov
stanislav.blinov at gmail.com
Fri Jan 17 16:32:52 PST 2014
On Saturday, 18 January 2014 at 00:23:14 UTC, Adam D. Ruppe wrote:
> Templates automatically infer their attributes based on the
> input, so you don't have to specify them there.
>
> If you do a foo!(nothrow_function)(), foo is also nothrow
> (unless, of course, it throws!)
This doesn't apply here. I'm not using function as a template
paramter.
That's the whole case here. Suppose I'm writing a template class
that's parametrized by some type, and in my method I want to call
methods of that type. I cannot make any of my functions nothrow
until I am sure the methods I call will not throw, and the
compiler will tell me. And how can I be sure they don't throw if
it's an arbitrary type? I can check it, sure, with that
isNoThrow() template. But how then to use that information in my
own function declaration?
More information about the Digitalmars-d
mailing list