Boost.Range fix to the combine function that did not show as a defect on most compilers.

This iteration also makes the code compatible with more compilers.

[SVN r61071]
This commit is contained in:
Neil Groves
2010-04-05 14:12:24 +00:00
parent 3a6c6c6bcd
commit 704ce0186a
2 changed files with 140 additions and 152 deletions

View File

@ -11,7 +11,7 @@
#include <boost/range/combine.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
#include <vector>
@ -26,23 +26,25 @@ struct add
};
template< class CombinedRng >
void apply( const CombinedRng& r )
void apply( const CombinedRng& r )
{
std::vector<int> v;
for( typename boost::range_iterator<const CombinedRng>::type
i = boost::begin(r),
e = boost::end(r);
i != e; ++i )
typedef BOOST_DEDUCED_TYPENAME boost::range_iterator<const CombinedRng>::type iterator_t;
iterator_t e = boost::end(r);
for (iterator_t i = boost::begin(r); i != e; ++i)
{
}
}
void test_combine()
{
std::vector<int> v1, v2, v3;
v1 = boost::assign::list_of(1)(2)(3)(4);
v2 = boost::assign::list_of(1)(2)(3)(4);
for (int i = 1; i <= 4; ++i)
{
v1.push_back(i);
v2.push_back(i);
}
int i1, i2;
BOOST_FOREACH( boost::tie( i1, i2 ), boost::combine(v1,v2) )