Boost logo

Boost-Commit :

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


Author: dgregor
Date: 2008-09-10 17:25:39 EDT (Wed, 10 Sep 2008)
New Revision: 48707
URL: http://svn.boost.org/trac/boost/changeset/48707

Log:
More axiomatizing in the container concepts
Text files modified:
   sandbox/committee/concepts/stdlib/clib-containers.tex | 39 +++++++++++++++++++++++++++++++++------
   1 files changed, 33 insertions(+), 6 deletions(-)

Modified: sandbox/committee/concepts/stdlib/clib-containers.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-containers.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-containers.tex 2008-09-10 17:25:39 EDT (Wed, 10 Sep 2008)
@@ -84,6 +84,13 @@
   \ref{associative.reqmts}, \ref{unord.req},
   \ref{vector.cons}). Thanks to Alisdair Meredith for pointing out
   this inconsistency!
+\item Fixed the \tcode{AccessBack} axiom in
+ \tcode{BackInsertionContainer} and
+ \tcode{MemberBackInsertionContainer}. Added an additional
+ requirement to the *\tcode{Insertion} axioms that states that the
+ value inserted is the value now stored at the place of
+ insertion. Also, added *\tcode{Insertion} axioms to the emplace
+ concepts (all thanks to Alisdair Meredith).
 \end{itemize}
 
 \end{titlepage}
@@ -987,6 +994,7 @@
 
   axiom FrontInsertion(C c, value_type x) {
     c == (push_front(c, x), pop_front(c), c);
+ x == (push_front(c, x), front(c));
   }
 }
 \end{itemdecl}
@@ -1007,12 +1015,13 @@
   void push_back(C&, const value_type&);
   void pop_back(C&);
 
- axiom AccessBack(C c) {
+ requires BidirectionalIterator<iterator> axiom AccessBack(C c) {
     if (begin(c) != end(c)) back(c) == *(--end(c));
   }
 
   axiom BackInsertion(C c, value_type x) {
     c == (push_back(c, x), pop_back(c), c);
+ x == (push_back(c), back(c));
   }
 }
 \end{itemdecl}
@@ -1054,6 +1063,10 @@
 \begin{itemdecl}
 concept FrontEmplacementContainer<typename C, typename... Args> : FrontInsertionContainer<C> {
   void emplace_front(C& c, Args... args);
+
+ axiom FrontEmplacement(C c, Args... args) {
+ c == (emplace_front(c, args...), pop_front(c), c);
+ }
 }
 \end{itemdecl}
 
@@ -1066,6 +1079,10 @@
 \begin{itemdecl}
 concept BackEmplacementContainer<typename C, typename... Args> : BackInsertionContainer<C> {
   void emplace_back(C& c, Args... args);
+
+ axiom BackEmplacement(C c, Args... args) {
+ c == (emplace_back(c, args...), pop_back(c), c);
+ }
 }
 \end{itemdecl}
 
@@ -1150,7 +1167,8 @@
   }
 
   axiom MemberFrontInsertion(C c, value_type x) {
- c == (c.push_front(x), c.pop_front(), c);
+ c == (c.push_front(x), c.pop_front(), c);
+ x == (c.push_front(x), c.front());
   }
 }
 \end{itemdecl}
@@ -1171,12 +1189,13 @@
   void C::push_back(const value_type&);
   void C::pop_back();
 
- axiom MemberAccessBack(C c) {
+ requires BidirectionalIterator<iterator> axiom MemberAccessBack(C c) {
     if (c.begin() != c.end()) c.back() == *(--c.end());
   }
 
   axiom MemberBackInsertion(C c, value_type x) {
     c == (c.push_back(x), c.pop_back(), c);
+ x == (c.push_back(x), c.back());
   }
 }
 \end{itemdecl}
@@ -1217,6 +1236,10 @@
 \begin{itemdecl}
 auto concept MemberFrontEmplacementContainer<typename C, typename... Args> : MemberFrontInsertionContainer<C> {
   void C::emplace_front(Args... args);
+
+ axiom MemberFrontEmplacement(C c, Args... args) {
+ c == (c.emplace_front(args...), c.pop_front(), c);
+ }
 }
 \end{itemdecl}
 
@@ -1229,6 +1252,10 @@
 \begin{itemdecl}
 auto concept MemberBackEmplacementContainer<typename C, typename... Args> : MemberBackInsertionContainer<C> {
   void C::emplace_back(Args... args);
+
+ axiom MemberFrontEmplacement(C c, Args... args) {
+ c == (c.emplace_back(args...), c.pop_back(), c);
+ }
 }
 \end{itemdecl}
 
@@ -1359,7 +1386,7 @@
 \pnum
 \addedConcepts{\mbox{\reallynote} Adapts an existing range-insertion container, which uses
   member function syntax for each of its operations, to the}
- \\\addedConcepts{\mbox{\tcode{RangeInsertionContainer}} concept.}
+ \addedConcepts{\mbox{\tcode{RangeInsertionContainer}} concept.}
 \end{itemdescr}
 
 \begin{itemdecl}
@@ -1374,7 +1401,7 @@
 \pnum
 \addedConcepts{\mbox{\reallynote} Adapts an existing front-emplace container, which uses
   member function syntax for each of its operations, to the}
- \\\addedConcepts{\mbox{\tcode{FrontEmplacementContainer}} concept.}
+ \addedConcepts{\mbox{\tcode{FrontEmplacementContainer}} concept.}
 \end{itemdescr}
 
 \begin{itemdecl}
@@ -1389,7 +1416,7 @@
 \pnum
 \addedConcepts{\mbox{\reallynote} Adapts an existing back-emplace container, which uses
   member function syntax for each of its operations, to the}
- \\\addedConcepts{\mbox{\tcode{BackEmplacementContainer}} concept.}
+ \addedConcepts{\mbox{\tcode{BackEmplacementContainer}} concept.}
 \end{itemdescr}
 
 \begin{itemdecl}


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