I want to create my own Tuple type

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Jan 11 14:53:08 UTC 2021


On Monday, 11 January 2021 at 14:51:29 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 11 January 2021 at 14:03:39 UTC, Paul Backus wrote:
>>     alias expand this;
>
> Hm... this does not allow me protect the fields from being 
> changed. I also cannot use const since it is transitive and 
> would make it impossible to return two references to mutable 
> objects?
>
> Basically, the tuple itself should be immutable, but not the 
> objects being referenced. I guess I could run over the types 
> and add const if they are not references?

But that would leave references mutable... so not the best 
solution. I kinda like the flexibility of __0, __1 and that it 
maps nicely to a regular struct.


More information about the Digitalmars-d-learn mailing list