Is there any way to specify that a generic function is
conditionally nothrow (or other function decorators), based on
whether the template instantiation is nothrow? I'm looking for
something akin to C++'s noexcept(noexcept()), e.g.:
template void foo() noexcept(noexcept(T())) {}
I don't see
On Sat, Jan 30, 2016 at 05:37:07AM +, Matt Elkins via Digitalmars-d-learn
wrote:
> On Saturday, 30 January 2016 at 05:25:49 UTC, Rikki Cattermole wrote:
> >On 30/01/16 6:17 PM, Matt Elkins wrote:
> >>[...]
> >
> >templated functions have attribute inference. Meaning if it can be
> >nothrow it
On Saturday, 30 January 2016 at 05:25:49 UTC, Rikki Cattermole
wrote:
On 30/01/16 6:17 PM, Matt Elkins wrote:
[...]
templated functions have attribute inference. Meaning if it can
be nothrow it will be.
Regarding your real use case, again struct if templated so it
should be inferred.
On 30/01/16 6:17 PM, Matt Elkins wrote:
Is there any way to specify that a generic function is conditionally
nothrow (or other function decorators), based on whether the template
instantiation is nothrow? I'm looking for something akin to C++'s
noexcept(noexcept()), e.g.:
template void foo()
On Saturday, 30 January 2016 at 05:57:34 UTC, H. S. Teoh wrote:
A common idiom that we use is to write an attributed unittest
to verify that the function itself is @safe/etc.. This way, if
instantiated with safe/etc. types, the template will also be
safe/etc., but if instantiated with an