From 4fc942f45e37d7ea9ee0f2e81f1aaf1a6036a214 Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Thu, 23 Dec 2010 11:56:27 +0000 Subject: [PATCH] [boost][range] - Resolved Trac ticket 4355 - Concepts did not check that iterators must be dereferencable. [SVN r67430] --- include/boost/range/concepts.hpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/include/boost/range/concepts.hpp b/include/boost/range/concepts.hpp index 8e4d2cf..d9f9bfc 100644 --- a/include/boost/range/concepts.hpp +++ b/include/boost/range/concepts.hpp @@ -98,8 +98,9 @@ namespace boost { // classes: // // The Range algorithms often do not require that the iterators are - // Assignable, but the correct standard conformant iterators - // do require the iterators to be a model of the Assignable concept. + // Assignable or default constructable, but the correct standard + // conformant iterators do require the iterators to be a model of the + // Assignable concept. // Iterators that contains a functor that is not assignable therefore // are not correct models of the standard iterator concepts, // despite being adequate for most algorithms. An example of this @@ -141,6 +142,23 @@ namespace boost { BOOST_DEDUCED_TYPENAME SinglePassIteratorConcept::traversal_category, single_pass_traversal_tag >)); + + BOOST_CONCEPT_USAGE(SinglePassIteratorConcept) + { + Iterator i2(++i); + boost::ignore_unused_variable_warning(i2); + + Iterator i3(i++); + boost::ignore_unused_variable_warning(i3); + + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::reference r1(*i); + boost::ignore_unused_variable_warning(r1); + + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::reference r2(*i++); + boost::ignore_unused_variable_warning(r2); + } + private: + Iterator i; #endif };