Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12767 closed Feature Requests (fixed)

Make value-initialized iterators of intrusive containers comparable

Reported by: fdegros@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: intrusive
Version: Boost 1.63.0 Severity: Problem
Keywords: Cc: fdegros@…

Description

Can value-initialized iterators of intrusive containers be compared?

For example, is the following code valid and well-defined?

using MyList = boost::intrusive::list<MyNode>;
using It = MyList::iterator;

It a = It();
It b = It();

assert(a == b);

This property is useful when it comes to returning empty ranges without having to create a dummy empty container.

If intrusive containers already support this property, then it would be good to explicitly mention it in the documentation. If not, I would like to add it as a feature request.

Change History (2)

comment:1 by Ion Gaztañaga, 6 years ago

Resolution: fixed
Status: newclosed

Thanks for the ticket. Boost.Intrusive supports comparison of value-initialized iterators. Documentation was missing, so I've done the following commit:

https://github.com/boostorg/intrusive/commit/47c8a19cfded4e31d03cd758a8663389d837b8be

comment:2 by fdegros@…, 6 years ago

Excellent.

Note: See TracTickets for help on using tickets.