Const initialization issue, looking for solution

Jakob Ovrum jakobovrum at gmail.com
Wed May 29 06:44:13 PDT 2013


On Wednesday, 29 May 2013 at 13:35:18 UTC, Maxim Fomin wrote:
> It is not casting away const and it has nothing to do with 
> immutable, also this does not suffer from data was actually 
> immutable problem.

The data is not initially constructed by the local function, it's 
clearly coming from somewhere else and there's no guarantee that 
it's not returning a const view of immutable data. The code is 
not limited to accepting const, of course, and exhibits the same 
problem when the function returns immutable data.

Unions are a convenience feature, it boils down to the same as a 
cast and has the same problems (actually worse because the 
conversion is not explicit).


More information about the Digitalmars-d mailing list