Q about template function overloads
Bill Baxter
dnewsgroup at billbaxter.com
Sun Dec 17 17:56:53 PST 2006
Bill Baxter wrote:
> Also how do I write the equivalent of this:
>
> static if( is( T S: S[]) ) {
> alias Array!(S) _ArrayTForT;
> }
>
> For the case where T is a user-defined array type:
> /// doesn't work!
> static if( is( T S: Array!(S)) ) {
> alias Array!(S) _ArrayTForT;
> }
> It really shouldn't just be an "else" catch-all in the code above. It
> should be checking for an instantiation of Array!().
This second part of my question seems to be a result of bug 688[1].
That is, the check 'is(T S:Array!(S))' *does* work if Array is a struct,
just not if it's a class.
But I would still be interested in any suggestions for how to do the
overloading in a more elegant way.
[1] http://d.puremagic.com/issues/show_bug.cgi?id=688
--bb
More information about the Digitalmars-d-learn
mailing list