Boost logo

Boost :

Subject: Re: [boost] difference_type size()?
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-10-19 16:29:40

On Wed, Oct 19, 2011 at 12:40 PM, Olaf van der Spek <ml_at_[hidden]> wrote:

> On Wed, Oct 19, 2011 at 9:31 PM, Jeffrey Lee Hellrung, Jr.
> <jeffrey.hellrung_at_[hidden]> wrote:
> > Yes. Changing iterator_traits (specifically, the collection of types
> > associated with an iterator) is where I'm leaning, if you really want an
> > unsigned iterator_range::size().
> If you've got another / better solution for the signed/unsigned
> mismatches that result from a signed size() I'd be happy to hear it
> from you.

I don't, and, indeed, I wasn't aware that difference_type was restricted to
be a builtin signed integral type. So make_unsigned seems to work.

> >> What would the problem be of just using std::size_t?
> >>
> >
> > Well, likewise, what would be the problem of always using std::ptrdiff_t
> for
> > difference_type? And, aside from whether std::size_t would be wide
> enough,
> How is difference_type relevant?

I was just making an analogy... Honestly, I'd be surprised if there were
any practical problems with using std::size_t, but likewise I'd be surprised
if there were any practical problems with always using std::ptrdiff_t for

- Jeff

Boost list run by bdawes at, gregod at, cpdaniel at, john at