On Saturday, 28 May 2016 at 21:21:34 UTC, ag0aep6g wrote:
On 05/28/2016 09:54 PM, chmike wrote:
The only inconvenience left is that we can't have mutable references
to immutable objects.

There is std.typecons.Rebindable for that.

That would be a good news. What is the right way to use it ? I had a hard time to understand how to use Rebindable.

Rebindable!(immutable Category) instance( return Rebindable!(immutable Category)(instance_); }

Or should, I do it like that ?

Rebindable!(const Category) instance( return Rebindable!(const Category)(instance_); }

The immutable and const concepts are really different from C and C++.

A problem with rebindable is that its current assembly translation for 'is' test does a byte per byte comparison which is much less efficient than a direct 64bit comparison of the struct. I checked that with dmd. I don't know about gdc and ldc. This is something that will,be optimized soon I hope.

Reply via email to