From 8c32f7a5e259c50b749b795a5201b966d25965f3 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 1 May 2006 13:17:48 +0000 Subject: [PATCH] Added missing value_type to InputIteratorConcept Improved idiomatic fake_sort [SVN r33889] --- fake_sort.hpp | 19 ++++++++++++------- include/boost/concept_check.hpp | 10 +++++----- where.cpp | 2 +- where_fail.cpp | 2 +- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/fake_sort.hpp b/fake_sort.hpp index e96504f..8f48f06 100755 --- a/fake_sort.hpp +++ b/fake_sort.hpp @@ -8,15 +8,20 @@ # include # include -template -BOOST_CONCEPT_WHERE( - ((boost::Mutable_RandomAccessIteratorConcept)) - ((boost::LessThanComparableConcept::value_type>)) - - , (void)) -fake_sort(RanIter,RanIter) +namespace fake { + using namespace boost; + + template + BOOST_CONCEPT_WHERE( + ((Mutable_RandomAccessIteratorConcept)) + ((LessThanComparableConcept::value_type>)) + + , (void)) + sort(RanIter,RanIter) + { + } } #endif // BOOST_LIBS_CONCEPT_CHECK_FAKE_SORT_DWA2006430_HPP diff --git a/include/boost/concept_check.hpp b/include/boost/concept_check.hpp index 37f435e..c89983e 100644 --- a/include/boost/concept_check.hpp +++ b/include/boost/concept_check.hpp @@ -462,9 +462,8 @@ namespace boost : AssignableConcept , EqualityComparableConcept { - // require iterator_traits typedef's + typedef typename boost::detail::iterator_traits::value_type value_type; typedef typename boost::detail::iterator_traits::difference_type difference_type; - // Hmm, the following is a bit fragile typedef typename boost::detail::iterator_traits::reference reference; typedef typename boost::detail::iterator_traits::pointer pointer; typedef typename boost::detail::iterator_traits::iterator_category iterator_category; @@ -591,9 +590,10 @@ namespace boost : RandomAccessIteratorConcept , Mutable_BidirectionalIteratorConcept { - ~Mutable_RandomAccessIteratorConcept() { - i[n] = *i; // require element access and assignment - } + ~Mutable_RandomAccessIteratorConcept() + { + i[n] = *i; // require element access and assignment + } private: TT i; typename boost::detail::iterator_traits::difference_type n; diff --git a/where.cpp b/where.cpp index a8d1b8e..dfbfd02 100755 --- a/where.cpp +++ b/where.cpp @@ -8,6 +8,6 @@ int main() { std::vector v; - fake_sort(v.begin(), v.end()); + fake::sort(v.begin(), v.end()); return 0; } diff --git a/where_fail.cpp b/where_fail.cpp index 6c10862..e56b40f 100755 --- a/where_fail.cpp +++ b/where_fail.cpp @@ -8,6 +8,6 @@ int main() { std::list v; - fake_sort(v.begin(), v.end()); + fake::sort(v.begin(), v.end()); return 0; }