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).

Reply via email to