Things to look up in the docs

Philippe Sigaud philippe.sigaud at gmail.com
Sat Jan 2 13:52:34 PST 2010


On Fri, Jan 1, 2010 at 17:26, Lars T. Kyllingstad
<public at kyllingen.nospamnet> wrote:

>  // Does T end up being the array or element type here?
>  template Foo(T: T[]) { ... }
>
>
Yeah, me too. So I end up putting external constraints and static ifs
everywhere:

template Foo(T) if isDynamicArray!T {
    alias ElementType!T E;
}

>// How many template parameters do I have to specify when
>// instantiating this template?
> template Bar(T: U*, U: int) { ... }

And is it the same than template Bar(U: int, T: U*) {...}?

Some others of the same kind:

why, to test if type U is a composite type (Cycle!(T), for example), do I
have to write
is(U u == Cycle!T, T)
and not
is(U == Cycle!T, T)? (If I'm not mistaken).
And to detect if some type is a std.typcons.tuple with
 is(T t = Tuple!U, U...)
doesn't work, because the is() doesn't accept variadic template arguments.
Too bad.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100102/7222e2bf/attachment.html>


More information about the Digitalmars-d mailing list