On Sat, Dec 17, 2011 at 01:23, Simen Kjærås wrote:
> A few small tests later:
>
> import std.typetuple;
> import std.typecons;
> import std.stdio;
>
> void main() {
> int a, b;
> TypeTuple!(a, b) = tuple(4,5);
>
> assert(a == 4 && b == 5);
> }
>
> In other words, the language already has
Am 17.12.2011 01:23, schrieb Simen Kjærås:
On Fri, 16 Dec 2011 14:00:11 +0100, Joshua Reusch
wrote:
Hello,
is there a way to say something like
---
int a, b;
AliasTuple!(a, b) = tuple(4,5);
assert(a == 4 && b == 5);
---
without having to write an own AliasTuple template ? I want to use it
f
On Fri, 16 Dec 2011 14:00:11 +0100, Joshua Reusch
wrote:
Hello,
is there a way to say something like
---
int a, b;
AliasTuple!(a, b) = tuple(4,5);
assert(a == 4 && b == 5);
---
without having to write an own AliasTuple template ? I want to use it
for functions returning multiple values.
> There is one in dranges:
>
> http://dsource.org/projects/dranges
>
> It is not officially documented, and I don't know how good it actually is,
> but here's what documentation exists:
>
> http://svn.dsource.org/projects/dranges/trunk/dranges/docs/reftuple.html
Hmm, thanks Simen, but no. It was a
On Fri, 16 Dec 2011 14:00:11 +0100, Joshua Reusch
wrote:
Hello,
is there a way to say something like
---
int a, b;
AliasTuple!(a, b) = tuple(4,5);
assert(a == 4 && b == 5);
---
without having to write an own AliasTuple template ? I want to use it
for functions returning multiple values.
I found a way doing this with a simple function:
---
void explode(R, T...)(R range, ref T values) {
static if(hasLength!R) assert(range.length == T.length);
foreach(i, value; range) values[i] = value;
}
---
but a more self-documenting version would be nice.
I think something like this is implemented in a dmd pull request.
Hello,
is there a way to say something like
---
int a, b;
AliasTuple!(a, b) = tuple(4,5);
assert(a == 4 && b == 5);
---
without having to write an own AliasTuple template ? I want to use it
for functions returning multiple values.
Joshua Reusch