Boost logo

Boost Users :

Subject: Re: [Boost-users] [range] boost::size wrong return type?
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2012-06-24 22:35:16


Hi Oswin

2012/6/22 Oswin Krause <Oswin.Krause_at_[hidden]>:
> Hi list,
>
> I'm using boost 1.49 and get an annoying number of signed/unsigned
> comparison warnings when i use boost::size. Which is because the return type
> seems to be signed
>
> When I look at boost/range/size.hpp, i get
>
> template<class SinglePassRange>
>  inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange>::type
> <--signed
> size(const SinglePassRange& rng)
>
>
> But the documentation for random access ranges tells otherwise:
>
> Expression:
> boost::size(a)
>
> Return Type:
> boost::range_size<X>::type
>
> and Forward Range defines range_size as:
>
> boost::range_size<X>::type
> An unsigned integral type that can represent any nonnegative value of the
> Range's distance type.
>
> assuming the documentation does not lie, I propose the following fix
>
> template<class SinglePassRange>
> inline BOOST_DEDUCED_TYPENAME range_size<SinglePassRange>::type
> size(const SinglePassRange& rng)
>
> Greetings,
> Oswin

This issue was fixed in trunk.
Please wait next release (maybe 1.51).

Thanks,
Akira

==
Akira Takahashi
faithandbrave_at_[hidden]
site: https://sites.google.com/site/faithandbrave/about/en


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net