Comparing observer_ptr <T> with T *

As far as I can see, the proposal observer_ptrincludes (c) comparing comparisons with comparisons nullptr_tand cross-type (i.e. observer_ptr< T >vs. observer_ptr<U>). There is no comparison with the original pointers, which is a little annoying when you try to gradually inject it into your existing code base.

Question 1 . Do you anticipate any serious problems if I add these operators (I use a separate implementation observer_ptrin a different namespace modeled in the current sentence, I will not add them to std::observer_ptr)?

Follow up actions . If adding statements is a bad idea, would it be better to use get () in observer_ptrto compare with the raw pointer, or would it be better to wrap the raw pointer explicitly like observer_ptr?

Edit: Apparently, this is not clear enough - I want to know why observer_ptr<T>these comparison operators are missing. If this is just an omission, I can add them to my implementation and be on my fun. If there is a reason for this choice, I would like to understand what it is and how careful I am not to add these operators to my class.

+4
source share
1 answer

, observer_ptr<T> T* . , , .get() ctor - .

+1

All Articles