[range] Make iterator of 'indexed' adaptor default-constructible (refs #7827).

[SVN r84617]
This commit is contained in:
Nathan Ridge
2013-06-03 09:00:46 +00:00
parent 1c18f42e83
commit c908e04144
3 changed files with 33 additions and 0 deletions

3
include/boost/range/adaptor/indexed.hpp Executable file → Normal file
View File

@ -55,6 +55,9 @@ namespace boost
index_type m_index;
public:
indexed_iterator()
: m_index(index_type()) {}
explicit indexed_iterator( Iter i, index_type index )
: base(i), m_index(index)
{

View File

@ -15,11 +15,14 @@
#include <boost/assign.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/concepts.hpp>
#include <algorithm>
#include <list>
#include <vector>
#include "../test_utils.hpp"
namespace boost
{
namespace
@ -83,6 +86,9 @@ namespace boost
{
indexed_test_impl< std::vector< int > >();
indexed_test_impl< std::list< int > >();
check_random_access_range_concept(std::vector<int>() | boost::adaptors::indexed(0));
check_bidirectional_range_concept(std::list<int>() | boost::adaptors::indexed(0));
}
}
}

24
test/test_utils.hpp Normal file
View File

@ -0,0 +1,24 @@
// Boost.Range library
//
// Copyright Akira Takahashi 2013. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
//
// For more information, see http://www.boost.org/libs/range/
//
#include <boost/range/concepts.hpp>
template <class RandomAccessRng>
void check_random_access_range_concept(const RandomAccessRng& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept<RandomAccessRng> ));
}
template <class BidirectionalRng>
void check_bidirectional_range_concept(const BidirectionalRng& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( boost::BidirectionalRangeConcept<BidirectionalRng> ));
}