On 10/2/12 12:45 PM, Peter Alexander wrote:
On Tuesday, 2 October 2012 at 16:29:28 UTC, Simen Kjaeraas wrote:
On 2012-10-02, 18:09, Peter Alexander wrote:

On Tuesday, 2 October 2012 at 13:17:45 UTC, monarch_dodra wrote:
If you've ever worked on a template that needs to index a range, you
may have run into this problem: What is the type you should use to
index an RA range?

Forgive my ignorance. What's wrong with size_t?

That not all ranges use it? If the range uses int, short, byte
(I wonder why they'd do it, though), using size_t will not even
compile.

That's kind of my point. Unless there's a compelling reason not to, I'd
suggest we standardise on size_t indexing (and length) and avoid this
issue altogether.

Yes. Unfortunately there are few, few cases in which size_t is insufficient (e.g. an input range from a file or a large iota, both on 32-bit builds). I personally think these are too few to need formal support.

C++ containers have a size_type typedef. No one uses it.

Agreed.

Let's keep things simple instead of complicating things for the sake of
unwanted "flexibility".

Yes. We should curb some corner cases of current range design in the direction of simplifying things.


Andrei

Reply via email to