Signature conditions

David Nadlinger see at klickverbot.at
Fri Feb 10 10:35:25 PST 2012


On 2/10/12 7:28 PM, H. S. Teoh wrote:
> I'm trying to write a parametrized class with a type parameter whose
> existence depends on whether std.utf.decode() exists for that type.
> What's the syntax to do this?

class(T) if (__traits(compiles, { std.utf.decode(T.init); } )) { … }

David


More information about the Digitalmars-d-learn mailing list