[range] boost::size wrong return type?

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

Hi Oswin
2012/6/22 Oswin Krause
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@gmail.com site: https://sites.google.com/site/faithandbrave/about/en
participants (2)
-
Akira Takahashi
-
Oswin Krause