Am 11.12.2010, 19:33 Uhr, schrieb bearophile <bearophileh...@lycos.com>:

Johannes Pfau:

Is there something like Unqual that can remove the safety attributes from
a type?

In such cases we have to ask what's your use case/purpose. Isn't @trusted enough?

Bye,
bearophile

Well, for my signal implementation (Latest code: http://ideone.com/SM11K ) I have templates which accept functions, delegates and callable objects. I used something like "static if(is(T == void delegate(int)))" to check if:
1. T is a delegate
2. it returns void
3. it takes one int parameter

In this case I'm only interested in these three points, I don't care if T is @safe @trusted or @system, but the above check fails if T is @safe.

I found a solution though, I now do these checks with functions from std.traits: ReturnType!(T) for the return type, is(typeof(T.init(Init!(Types)))) for parameters and is(T == delegate). Seems to work fine now.
--
Johannes Pfau

Reply via email to