diff --git a/include/boost/range/adaptor/indexed.hpp b/include/boost/range/adaptor/indexed.hpp old mode 100755 new mode 100644 index 5a523ce..cb2c127 --- a/include/boost/range/adaptor/indexed.hpp +++ b/include/boost/range/adaptor/indexed.hpp @@ -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) { diff --git a/test/adaptor_test/indexed.cpp b/test/adaptor_test/indexed.cpp index 2a9c45d..a5bef4d 100644 --- a/test/adaptor_test/indexed.cpp +++ b/test/adaptor_test/indexed.cpp @@ -15,11 +15,14 @@ #include #include +#include #include #include #include +#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() | boost::adaptors::indexed(0)); + check_bidirectional_range_concept(std::list() | boost::adaptors::indexed(0)); } } } diff --git a/test/test_utils.hpp b/test/test_utils.hpp new file mode 100644 index 0000000..7af920a --- /dev/null +++ b/test/test_utils.hpp @@ -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 + +template +void check_random_access_range_concept(const RandomAccessRng& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept )); +} + +template +void check_bidirectional_range_concept(const BidirectionalRng& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( boost::BidirectionalRangeConcept )); +}