Tuple and tie?
Remo via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 8 11:45:20 PDT 2014
On Tuesday, 8 July 2014 at 18:29:40 UTC, Meta wrote:
> On Tuesday, 8 July 2014 at 17:42:00 UTC, Remo wrote:
>>
>> How to make something that work like std::tie in D2 ?
>>
>> Tuple!(float, float) sinCos(float n) {
>> return tuple(cast(float)sin(n), cast(float)cos(n)); //please
>> note cast(float)!
>> }
>>
>> int main(string[] argv) {
>> float s,c;
>> tie!(s,c) = sinCos(3.0f);
>> }
>
> alias tie = TypeTuple;
>
> int main(string[] argv)
> {
> float s,c;
> tie!(s,c) = sinCos(3.0f);
> }
Thanks !
This is easier as I was thinking :)
Now I only need to be sure that this do not have unwanted side
effects.
More information about the Digitalmars-d-learn
mailing list