On 04/16/2012 08:15 PM, sclytrack wrote:
const numbers = new int[2];
const c = const(AB)(a, 20, numbers);
writeln(c);
}
Bye,
bearophile
That's exactly what I needed, thanks.
Seems to be forwarded to the constructor if there is one.
(untested code)
struct B
{
int [] _list;
this( const int [] list) const
{
_list = list;
//typeof(_list)=int []
//typeof(list) =const(int[])
}
}
Because of the const on the back of the constructor.
Normally the typeof(_list) should be const(int[])
but assignable once, because we are in the constructor.
But a mutable design has been chosen (_list is int [])
until it is baked or cooked
or whatever the terminology. (don't have Andrei's book)
Probably for flexibility. Are there people out there
using this flexibility?
Just pondering,
Sclytrack