jeudi 23 juin 2016

Comparing observer_ptr< T > with T *

As far as I can see, the observer_ptr proposal includes (in)equality comparisons with nullptr_t and cross-type (i.e., observer_ptr< T > vs. observer_ptr< U >) comparisons. There is no comparison with raw pointers, which is a bit of an annoyance when trying to gradually introduce it into an existing code base.

Question 1: Do you foresee any serious issues if I add these operators (I am using a separate implementation of observer_ptr in a different namespace, modeled exactly on the current proposal, I will not be adding these to the std::observer_ptr)?

Follow-up: If adding the operators is a bad idea, would it be better to use get() on the observer_ptr to compare against the raw pointer, or would it be better to wrap the raw pointer explicitly as a observer_ptr?

Aucun commentaire:

Enregistrer un commentaire