Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r48704 - sandbox/committee/concepts/stdlib
From: dgregor_at_[hidden]
Date: 2008-09-10 16:07:11


Author: dgregor
Date: 2008-09-10 16:07:10 EDT (Wed, 10 Sep 2008)
New Revision: 48704
URL: http://svn.boost.org/trac/boost/changeset/48704

Log:
Make iterator_traits SFINAE-safe
Text files modified:
   sandbox/committee/concepts/stdlib/clib-iterconcepts.tex | 37 ++++++++++++++++++++++++++++++++++++-
   1 files changed, 36 insertions(+), 1 deletions(-)

Modified: sandbox/committee/concepts/stdlib/clib-iterconcepts.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-iterconcepts.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-iterconcepts.tex 2008-09-10 16:07:10 EDT (Wed, 10 Sep 2008)
@@ -267,6 +267,14 @@
   iterator traits section, so that others of these deprecated
   constructs can refer to iterator categories. Thanks to Alisdair
   Meredith for noting this omission.
+\item Made \tcode{iterator_traits} SFINAE-safe
+ (\ref{iterator.traits}), which is important for backward
+ compatibility. In particular, the concept maps that map C++03
+ iterators into C++0x iterators (by querying
+ \mbox{\tcode{iterator_traits}}) need to be robust against looking at
+ types that don't have all of the nested types, e.g., the
+ instantiation of \tcode{iterator_traits<int>} should produce an
+ empty class, not an error.
 \end{itemize}
 \end{titlepage}
 
@@ -1253,7 +1261,34 @@
       iterator}}, \mbox{\techterm{bidirectional iterator}}, or
   \mbox{\techterm{random access iterator}}.}
 
-\editorial{The existing paragraphs 2--5 of this section are
+\setcounter{Paras}{1}
+\pnum
+\changedConcepts{The}{If the type \mbox{\tcode{Iterator}} has nested types
+ \mbox{\tcode{difference_type}}, \mbox{\tcode{value_type}},
+ \mbox{\tcode{pointer}}, \mbox{\tcode{reference}}, and
+ \mbox{\tcode{iterator_category}}, then the}
+template \tcode{iterator_traits<Iterator>} is defined as
+\begin{itemdecl}
+namespace std {
+ template<class Iterator> struct iterator_traits {
+ typedef typename Iterator::difference_type difference_type;
+ typedef typename Iterator::value_type value_type;
+ typedef typename Iterator::pointer pointer;
+ typedef typename Iterator::reference reference;
+ typedef typename Iterator::iterator_category iterator_category;
+ };
+}
+\end{itemdecl}
+\addedConcepts{otherwise, it is defined as}
+\color{addclr}
+\begin{itemdecl}
+namespace std {
+ template<class Iterator> struct iterator_traits { };
+}
+\end{itemdecl}
+\color{black}
+
+\editorial{The existing paragraphs 3--5 of this section are
   unchanged. Add a new paragraph at the end of this section:}
 
 \setcounter{Paras}{6}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk