forked from boostorg/range
[range] Make iterator of 'indexed' adaptor default-constructible (refs #7827).
[SVN r84617]
This commit is contained in:
3
include/boost/range/adaptor/indexed.hpp
Executable file → Normal file
3
include/boost/range/adaptor/indexed.hpp
Executable file → Normal file
@ -55,6 +55,9 @@ namespace boost
|
|||||||
index_type m_index;
|
index_type m_index;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
indexed_iterator()
|
||||||
|
: m_index(index_type()) {}
|
||||||
|
|
||||||
explicit indexed_iterator( Iter i, index_type index )
|
explicit indexed_iterator( Iter i, index_type index )
|
||||||
: base(i), m_index(index)
|
: base(i), m_index(index)
|
||||||
{
|
{
|
||||||
|
@ -15,11 +15,14 @@
|
|||||||
|
|
||||||
#include <boost/assign.hpp>
|
#include <boost/assign.hpp>
|
||||||
#include <boost/range/algorithm_ext.hpp>
|
#include <boost/range/algorithm_ext.hpp>
|
||||||
|
#include <boost/range/concepts.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "../test_utils.hpp"
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
@ -83,6 +86,9 @@ namespace boost
|
|||||||
{
|
{
|
||||||
indexed_test_impl< std::vector< int > >();
|
indexed_test_impl< std::vector< int > >();
|
||||||
indexed_test_impl< std::list< 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
24
test/test_utils.hpp
Normal 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> ));
|
||||||
|
}
|
Reference in New Issue
Block a user