My problem with const

Freddy via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 4 16:26:37 PDT 2015


I love the way D does transitive const and immutable but i have a 
problem when i use const a struct field.
---
struct MyStruct
{
     int a;
     const int b;
}

struct Range
{
     MyStruct front;
     void popFront()
     {
         front = MyStruct(2, 3);
     }

     enum empty = false;
}
---
This sample doesn't compile.


More information about the Digitalmars-d mailing list