looking for V[string] workarounds

Ali Çehreli acehreli at yahoo.com
Wed Mar 20 10:44:16 PDT 2013


On 03/20/2013 10:24 AM, Dan wrote:
> On Wednesday, 20 March 2013 at 17:11:02 UTC, Ali Çehreli wrote:
>> The code compiles with 2.062 and an earlier version of 2.063 if you
>> accept letting go of const-correctness there:
>>
>> this(Series[string] source) {
>>
>
> Thanks Ali. But, removing const there then requires non-const instances
> to be passed in, due to const transitivity. So that requirement would
> ripple a change to all already const correct instances to now need to
> flip to non-const. I'm looking for a const correct solution. It should
> be doable ... I just have had no luck with it.

In that case, brute force to the rescue (nc stands for non-const): :)

   this(const(Series[string]) source) {
       auto nc_source = cast(Series[string])source;
     itemToSeries = nc_source.dup;
   }

Ali


More information about the Digitalmars-d-learn mailing list