Boost logo

Boost :

Subject: Re: [boost] difference_type size()?
From: andrey.semashev_at_[hidden]
Date: 2011-10-19 15:38:49


On Wednesday, October 19, 2011 12:27:31 Jeffrey Lee Hellrung, Jr. wrote:
> >
> > So bidirectional iterators, for instance, may denote a valid range that
> > exceeds difference_type capacity. This is actually a little caveat in
> > the
> > Standard.
>
> A bit surprising, but I'll take your word for it. In any case, it's some
> irrelevant for non-random-access iterators as iterator_range::size() is only
> defined for random access iterators, no?

No, iterator_range can be used with any iterators.

> > I think the following would do:
> > typedef typename make_unsigned< difference_type >::type size_type;
>
> I was under the impression that most of the traits in Boost.TypeTraits of
> this nature are only defined for builtin types.

See one of my previous replies, difference type should be a signed integer
type.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk