Const Tuples

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 25 05:17:30 PDT 2014


Dicebot:

> Why would you even expect those to be same types? These 2 types 
> are also different:
>
> struct A
> {
>     const int x;
> }
>
> alias A_ = const(A);

In general a tuple is a higher level data structure compared to a 
struct. So it's not unreasonable to expect a Tuple to be more 
flexible than a struct.

But in the specific const tuple case I don't know if it's a good 
idea to ask for a const tuple to be of the same type of a tuple 
with all const fields.

I was just expressing a little frustration :-)

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list