On Saturday, 8 October 2022 at 23:06:13 UTC, Anonymouse wrote:
I have some nested templated code that takes function pointers. In many cases I pass it functions of identical signatures, except some are `@safe` and others are `@system`. In those cases the templates end up getting instantiated twice. I don't care about the `@safe`-ness and I'd really like to just have them all treated as `@system`, with one instantiation per unique signature.

To illustrate:

[...]

...but there are a lot of different signatures and I need a general approach. There doesn't seem to be such a thing as `cast(@system)fp`.

My current solution involves some very gnarly string mixins.

I see what you mean, in the past I wanted `cast(pure)`, `cast(nothrow)`, similarly to avoid using metaprog (or maybe was that delegates) in certain case.

[...]
But surely there has to be a better way?

No.

Reply via email to