Hi, On 05/14/2013 03:41 PM, Jonathan Wakely wrote:
I'd forgotten about the existence of __const_pointer_cast etc. in <ext/cast.h> ...
Me too ;) I resorted to it as a sort of temporary kludge.
I agree that in C++11 mode __normal_iterator::_M_const_cast should not rely on the existence of a get() member on the custom pointer, because that's not required to exist, and you can do it like this instead: using PT = pointer_traits<ToType>; auto to = PT::pointer_to(const_cast<PT::element_type&>(*from));
Indeed, I have something like this in my tree too.
Thanks! Paolo.