For is boost::weak_ptrdefined operator<, therefore it can be used in associative containers.
My question is: is the sorting order of several objects ordered weak_ptr, even when some of them change to zero? Isn't that a mess with containers like std::set?
Example:
using namespace boost;
shared_ptr<A> sptrA1(new A);
weak_ptr<A> wptrA1 = sptrA1;
weak_ptr<A> wptrA2;
{
shared_ptr<A> sptrA2(new A);
wptrA2 = sptrA2;
assert(wptrA1 < wptrA2);
}
assert(wptrA1 < wptrA2);
- Would it be argued that # 2 is always true if statement # 1 is true?
- Is it
wptrA2in the same condition before and after area 1?
source
share