Subject: Re: [boost] difference_type size()?
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-10-20 11:48:59
On Thu, Oct 20, 2011 at 8:32 AM, Bo Persson <bop_at_[hidden]> wrote:
> Jeffrey Lee Hellrung, Jr. wrote:
> > On Wed, Oct 19, 2011 at 12:38 PM, <andrey.semashev_at_[hidden]> wrote:
> >> On Wednesday, October 19, 2011 12:27:31 Jeffrey Lee Hellrung, Jr.
> >> wrote:
> > [...]
> >>>> 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.
> > Ah, indeed. Then I agree make_unsigned would be a legitimate
> > solution.
> This will break if difference_type is a UDT without a make_unsigned
> Is that a good idea?
The wording of the standard says that difference_type is a "signed integer
type", seeming to imply that it shouldn't be a UDT.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk