expand variadic template parameters
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Mar 10 12:16:12 PDT 2015
On Tue, 10 Mar 2015 19:11:21 +0000, André wrote:
> Hi,
>
> in this minified example I try to expand the variadic parmaters of foo
> to bar:
>
> import std.typecons;
>
> void foo(T ...)(T args)
> {
> bar(args.expand);
> }
>
> void bar(int i, string s){}
>
> void main()
> {
> foo(1, "a");
> }
>
> I got the syntax error: no property 'expand' for type '(int, string)'
> I understand args is a TypeTuple and therefore expand is not working.
> Is there a simple way to get it working?
sure. just remove `.expand`. ;-)
void foo(T...) (T args) {
bar(args);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150310/bde81c51/attachment.sig>
More information about the Digitalmars-d-learn
mailing list