C++ Logo


Advanced search

Re: std::vector::indices()

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 3 Mar 2021 10:59:54 -0500
If you want to write such a function, it should be a global function
(customization point-style) that operates on any SizedRange (maybe
also RandomAccess?).

However, I don't believe that the desire for the largest valid index
is sufficiently motivated to be something that we should add to the
standard. You also need to account for what a function that returns
the largest valid index should return when the range is empty and
therefore there *is no* valid index.

Received on 2021-03-03 10:00:23