On 02/10/2012 07:50 PM, H. S. Teoh wrote:
On Fri, Feb 10, 2012 at 07:36:38PM +0100, David Nadlinger wrote:
On 2/10/12 7:35 PM, David Nadlinger wrote:
class(T) if (__traits(compiles, { std.utf.decode(T.init); } )) { … }

(untested, you might have to return the value from the delegate to
avoid an expression-without-effect error)

Works for me. Thanks!!

On that note, I discovered that if you want signature constraints on a
derived class, the syntax is unbearably ugly:

        class Derived(T)
                if (/* conditions */)
                : Base
        {
                ...
        }

I would have expected the syntax to be like this instead:

        class Derived(T) : Base
                if (/* conditions */)
        {
                ...
        }

But this doesn't compile.


T


It makes more sense as it is. Consider the instantiation 'Derived!int' and the condition 'is(typeof(T)==class)'.

Reply via email to