6 Sep
2017
6 Sep
'17
3:18 p.m.
Hi degski,
degski
On 4 September 2017 at 18:12, Phil Endecott via Boost
wrote:
But that gets complicated if you need iterators with the normal behaviour.
Wrap a std::vector or a std::array (if fixed size) and forward the begin() and end() iterators of the container. This then will also give you range based for loops (for free) on your type.
Of course that works for a sorted vector. But in the part of my message that you didn't quote, I mentioned storing the values in an unsorted vector and doing linear search. In this case, you can usefully iterate over the entire container as long as you don't care about the order, but you can't iterate over, for example, the range between two elements that you get from find(). Regards, Phil.