Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r48689 - sandbox/committee/concepts/stdlib
From: dgregor_at_[hidden]
Date: 2008-09-09 17:40:24


Author: dgregor
Date: 2008-09-09 17:40:23 EDT (Tue, 09 Sep 2008)
New Revision: 48689
URL: http://svn.boost.org/trac/boost/changeset/48689

Log:
Address more comments from Daniel
Text files modified:
   sandbox/committee/concepts/stdlib/clib-concepts.tex | 34 +++++++++++++++++++++++++++-------
   sandbox/committee/concepts/stdlib/clib-iterators.tex | 39 ++++++++++++++++++++++++++-------------
   2 files changed, 53 insertions(+), 20 deletions(-)

Modified: sandbox/committee/concepts/stdlib/clib-concepts.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-concepts.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-concepts.tex 2008-09-09 17:40:23 EDT (Tue, 09 Sep 2008)
@@ -101,6 +101,21 @@
 to better match with the dereference operator in \tcode{Iterator}. See
 Daniel Kr\"ugler's message c++std-lib-22198 on the reflector for
 rationale.
+
+\item Several updates to properly cope with abstract classes, thanks
+ to Daniel Kr\"ugler:
+ \begin{itemize}
+ \item Don't implicitly define \tcode{Returnable} concept maps for
+ abstract classes.
+ \item \tcode{HasDestructor} does not refine \tcode{VariableType},
+ since abstract classes can have destructors (but aren't
+ \tcode{VariableType}s). Similarly for
+ \tcode{ExplicitlyConvertible}.
+ \item Add a restriction to [concept.transform] that prohibits users
+ from adding concept maps for these concepts.
+ \end{itemize}
+ \item Implicitly define \tcode{TriviallyEqualityComparable} concept
+ maps for enumeration types.
 \end{itemize}
 
 \end{titlepage}
@@ -316,12 +331,12 @@
 
 \rSec2[concept.support]{Support concepts}
 \pnum
-The concepts in [concept.support] provide the ability to state
+\addedConcepts{The concepts in [concept.support] provide the ability to state
 template requirements for C++ type classifications ([basic.types]) and
 type relationships that cannot be expressed directly with concepts
 ([concept]). Concept maps for these concepts are implicitly defined.
 A program shall not provide concept maps for any concept in
-[concept.support].
+[concept.support].}
 
 \begin{itemdecl}
 concept Returnable<typename T> { }
@@ -338,7 +353,8 @@
 \addedConcepts{type \mbox{\tcode{T}} that is
   \mbox{\techterm{cv}} \mbox{\tcode{void}} or that meets the
   requirement \mbox{\tcode{MoveConstructible<T>}}
- (\mbox{\ref{concept.copymove}}), the concept map
+ (\mbox{\ref{concept.copymove}}) and is not an abstract class,
+ the concept map
   \mbox{\tcode{Returnable<T>}} shall be implicitly defined in
   namespace \mbox{\tcode{std}}.}
 \end{itemdescr}
@@ -670,6 +686,10 @@
 \end{itemdescr}
 
 \rSec2[concept.transform]{Type transformations}
+\pnum
+\addedConcepts{A program shall not provide concept maps for any concept in
+[concept.support].}
+
 \begin{itemdecl}
 auto concept IdentityOf<typename T> {
   typename type = T;
@@ -1329,8 +1349,8 @@
 negatives, but never false positives. \mbox{\exitnote}}
 
 \pnum
-\addedConcepts{\mbox{\requires} for every integral type
- \mbox{\tcode{T}} and pointer type, a concept map
+\addedConcepts{\mbox{\requires} for every integral, pointer, or enumeration type
+ \mbox{\tcode{T}}, a concept map
   \mbox{\tcode{TriviallyEqualityComparable<T>}} shall be
   defined in namespace \mbox{\tcode{std}}.}
 \end{itemdescr}
@@ -1437,7 +1457,7 @@
 
 \rSec2[concept.destruct]{Destruction}
 \begin{itemdecl}
-auto concept HasDestructor<typename T> : VariableType<T> {
+auto concept HasDestructor<typename T> {
   T::~T();
 }
 \end{itemdecl}
@@ -1729,7 +1749,7 @@
 \rSec2[concept.convertible]{Convertibility}
 
 \begin{itemdecl}
-auto concept ExplicitlyConvertible<typename T, typename U> : VariableType<T> {
+auto concept ExplicitlyConvertible<typename T, typename U> {
   explicit operator U(const T&);
 }
 \end{itemdecl}

Modified: sandbox/committee/concepts/stdlib/clib-iterators.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-iterators.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-iterators.tex 2008-09-09 17:40:23 EDT (Tue, 09 Sep 2008)
@@ -50,7 +50,7 @@
 \begin{center}
 \huge
 Concepts for the C++0x Standard Library: Iterators \\
-(Revision 3)
+(Revision 4)
 \vspace{0.5in}
 
 \normalsize
@@ -59,14 +59,24 @@
 \end{center}
 
 \vspace{1in}
-\par\noindent Document number: N2734=08-0244 \vspace{-6pt}
-\par\noindent Revises document number: N2323=07-0183 \vspace{-6pt}
+\par\noindent Document number: DRAFT \vspace{-6pt}
+\par\noindent Revises document number: N2734=08-0244 \vspace{-6pt}
 \par\noindent Date: \today\vspace{-6pt}
 \par\noindent Project: Programming Language \Cpp{}, Library Working Group\vspace{-6pt}
 \par\noindent Reply-to: Douglas Gregor $<$\href{mailto:dgregor_at_[hidden]}{dgregor_at_[hidden]}$>$\vspace{-6pt}
 
 \section*{Introduction}
 \libintrotext{24}
+
+\paragraph*{Changes from N2734}
+\begin{itemize}
+\item Fixed the \tcode{HasMinus} requirement on
+ \tcode{reverse_iterator}'s \tcode{operator-}.
+\item When using \tcode{decltype} in the return type of one of the
+ iterator adaptors' \tcode{operator-} operations, use the
+ \tcode{base()} function rather than \tcode{current} to retrieve the
+ underlying iterator.
+\end{itemize}
 \end{titlepage}
 
 %% --------------------------------------------------
@@ -185,10 +195,10 @@
       const reverse_iterator<Iter@\removedConcepts{ator}@1>& x,
       const reverse_iterator<Iter@\removedConcepts{ator}@2>& y);
   template <@\changedConcepts{class}{RandomAccessIterator}@ Iter@\removedConcepts{ator}@1, @\changedConcepts{class}{RandomAccessIterator}@ Iter@\removedConcepts{ator}@2>
- @\addedConcepts{requires HasMinus<Iter2::difference_type, Iter1::difference_type>}@
+ @\addedConcepts{requires HasMinus<Iter2, Iter1>}@
     auto operator-(
       const reverse_iterator<Iter@\removedConcepts{ator}@1>& x,
- const reverse_iterator<Iter@\removedConcepts{ator}@2>& y) -> decltype(y.current - x.current);
+ const reverse_iterator<Iter@\removedConcepts{ator}@2>& y) -> decltype(y.base() - x.base());
   template <@\changedConcepts{class}{RandomAccessIterator}@ Iterator>
     reverse_iterator<Iter@\removedConcepts{ator}@> operator+(
       @\changedConcepts{typename reverse_iterator<Iterator>::difference_type}{Iter::difference_type}@ n,
@@ -214,7 +224,7 @@
 
   template <@\changedConcepts{class}{InsertionContainer}@ Container> class insert_iterator;
   template <@\changedConcepts{class}{InsertionContainer}@ Container>
- insert_iterator<Container> inserter(Container& x, typename Container::iterator i);
+ insert_iterator<Container> inserter(Container& x, Container::iterator i);
   @\addedConcepts{template<InsertionContainer Container>}@
     @\addedConcepts{concept_map Iterator<insert_iterator<Container> > \{ \}}@
 
@@ -490,10 +500,10 @@
       const reverse_iterator<Iter@\removedConcepts{ator}@1>& x,
       const reverse_iterator<Iter@\removedConcepts{ator}@2>& y);
   template <@\changedConcepts{class}{RandomAccessIterator}@ Iter@\removedConcepts{ator}@1, @\changedConcepts{class}{RandomAccessIterator}@ Iter@\removedConcepts{ator}@2>
- @\addedConcepts{requires HasMinus<Iter2::difference_type, Iter1::difference_type>}@
+ @\addedConcepts{requires HasMinus<Iter2, Iter1>}@
     auto operator-(
       const reverse_iterator<Iter@\removedConcepts{ator}@1>& x,
- const reverse_iterator<Iter@\removedConcepts{ator}@2>& y) -> decltype(y.current - x.current);
+ const reverse_iterator<Iter@\removedConcepts{ator}@2>& y) -> decltype(y.base() - x.base());
   template <@\changedConcepts{class}{RandomAccessIterator}@ Iterator>
     reverse_iterator<Iter@\removedConcepts{ator}@> operator+(
       @\changedConcepts{typename reverse_iterator<Iterator>::difference_type}{Iter::difference_type}@ n,
@@ -920,10 +930,10 @@
 \index{operator-@\tcode{operator-}!\tcode{reverse_iterator}}%
 \begin{itemdecl}
 template <@\changedConcepts{class}{RandomAccessIterator}@ Iter@\removedConcepts{ator}@1, @\changedConcepts{class}{RandomAccessIterator}@ Iter@\removedConcepts{ator}@2>
- @\addedConcepts{requires HasMinus<Iter2::difference_type, Iter1::difference_type>}@
+ @\addedConcepts{requires HasMinus<Iter2, Iter1>}@
   auto operator-(
     const reverse_iterator<Iter@\removedConcepts{ator}@1>& x,
- const reverse_iterator<Iter@\removedConcepts{ator}@2>& y) -> decltype(y.current - x.current);
+ const reverse_iterator<Iter@\removedConcepts{ator}@2>& y) -> decltype(y.base() - x.base());
 \end{itemdecl}
 
 \begin{itemdescr}
@@ -1329,7 +1339,7 @@
   };
 
   template <@\changedConcepts{class}{InsertionContainer}@ Container>
- insert_iterator<Container> inserter(Container& x, typename Container::iterator i);
+ insert_iterator<Container> inserter(Container& x, Container::iterator i);
 
   @\addedConcepts{template<InsertionContainer Container>}@
     @\addedConcepts{concept_map Iterator<insert_iterator<Container> > \{ \}}@
@@ -1379,7 +1389,7 @@
 \index{operator=@\tcode{operator=}!\tcode{insert_iterator}}%
 \begin{itemdecl}
 insert_iterator<Container>&
- operator=(typename Container::value_type&& value);
+ operator=(Container::value_type&& value);
 \end{itemdecl}
 
 \begin{itemdescr}
@@ -1589,7 +1599,7 @@
 \end{itemdescr}
 
 \begin{itemdecl}
-explicit move_iterator(Iter@\removedConcepts{ator}@ i};
+explicit move_iterator(Iter@\removedConcepts{ator}@ i);
 \end{itemdecl}
 
 \begin{itemdescr}
@@ -1932,6 +1942,9 @@
 
 \end{paras}
 
+\section*{Acknowledgments}
+Thanks to Daniel Kr\"ugler for many helpful comments and corrections.
+
 \bibliographystyle{plain}
 \bibliography{../local}
 


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