|
Boost : |
Subject: Re: [boost] [RangeEx] Range & RangeEx
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2008-09-13 07:33:38
I'm reading algorithm.hpp. I'm puzzled about one thing.
There are overloads of lots of algs, such as find.
1 template<typename Rng,typename Val>
inline BOOST_DEDUCED_TYPENAME boost::range_iterator<Rng>::type
find(Rng & rng,Val const & val)
{
return std::find(boost::begin(rng),boost::end(rng),val);
}
2 template<typename Rng,typename Val>
inline BOOST_DEDUCED_TYPENAME boost::range_iterator<const Rng>::type
find(Rng const & rng,Val const & val)
{
return std::find(boost::begin(rng),boost::end(rng),val);
}
I'm puzzled what's different between 1, where Rng is "const T", vs 2, where Rng is "T"? In other words, why do we need both? The only thing that seems different is "boost::begin(rng)", but that's already overloaded for const.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk