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(<expr>)), e.g.:

template <class T> void foo() noexcept(noexcept(T())) {}

I don't see anything about it on the functions grammar page (https://dlang.org/spec/function.html). I do see something to do with nothrow_ on the std.traits page, but I'm not sure how to use it to achieve this or whether that is the right approach.

My actual use case is a non-generic method opAssign inside of a generic struct.

Reply via email to