From c908e04144aa1926c8de642ed650f04d23901985 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Mon, 3 Jun 2013 09:00:46 +0000 Subject: [PATCH] [range] Make iterator of 'indexed' adaptor default-constructible (refs #7827). [SVN r84617] --- include/boost/range/adaptor/indexed.hpp | 3 +++ test/adaptor_test/indexed.cpp | 6 ++++++ test/test_utils.hpp | 24 ++++++++++++++++++++++++ 3 files changed, 33 insertions(+) mode change 100755 => 100644 include/boost/range/adaptor/indexed.hpp create mode 100644 test/test_utils.hpp 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 )); +}