Boost logo

Boost-Commit :

From: mmarcus_at_[hidden]
Date: 2008-06-27 21:07:23


Author: mmarcus
Date: 2008-06-27 21:07:21 EDT (Fri, 27 Jun 2008)
New Revision: 46799
URL: http://svn.boost.org/trac/boost/changeset/46799

Log:
Some steps towards SequenceContainer. Concept maps still too long,
formatting not complete, and no array concept map.

Text files modified:
   sandbox/committee/concepts/stdlib/clib-containers.tex | 58 +++++++++++++++++++++++++++++++++++----
   1 files changed, 51 insertions(+), 7 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-06-27 21:07:21 EDT (Fri, 27 Jun 2008)
@@ -347,28 +347,72 @@
 \end{itemdecl}
 
 \begin{itemdecl}
-auto concept SequenceContainer<typename C> : Container<C> {
- reference C::front();
- const_reference C::front() const;
- reference C::back();
- const_reference C::back() const;
+concept SequenceContainer<typename C> : Container<C> {
+ reference @\changedCCC{C::front()}{front(C\&)}@;
+ const_reference @\changedCCC{C::front() const}{front(const C\&)}@;
+ reference @\changedCCC{C::back()}{back(C\&)}@;
+ const_reference @\changedCCC{C::back() const}{back(const C\&)}@;
 
   axiom AccessFront(C c) {
- if (c.begin() != c.end()) c.front() == *c.begin();
+ @\removedCCC{if (c.begin() != c.end()) c.front() == *c.begin();}@
+ @\addedCC{if (begin(c) != end(c)) front(c) == *begin(c);}@
   }
 
   axiom AccessBack(C c) {
- if (c.begin() != c.end()) c.back() == *(--c.end());
+ @\removedCCC{if (c.begin() != c.end()) c.back() == *(--c.end());}@
+ @\addedCC{if (begin(c) != end(c)) back(c) == *(-{}-end(c));}@
   }
 }
 \end{itemdecl}
 
+
 \begin{itemdescr}
 \pnum
 \addedConcepts{\mbox{\reallynote} describes a sequence container,
   which stores its elements in the order in which they were added.}
 \end{itemdescr}
 
+
+\begin{itemdecl}
+auto concept MemberSequenceContainer<typename C> : MemberContainer<C> {
+ reference C::front();
+ const_reference C::front() const;
+ reference C::back();
+ const_reference C::back() const;
+
+ axiom AccessFront(C c) {
+ if (c.begin() != c.end()) c.front() == *c.begin();
+ }
+
+ axiom AccessBack(C c) {
+ if (c.begin() != c.end()) c.back() == *(-{}-c.end());
+ }
+}
+\end{itemdecl}
+
+\begin{itemdecl}
+template <MemberSequenceContainer C>
+concept_map SequenceContainer<C> {
+ typedef typename C::reference reference;
+ typedef typename C::const_reference const_reference;
+ typedef typename C::iterator iterator;
+ typedef typename C::const_iterator const_iterator;
+
+ reference front(C& c) { return c.front(); }
+ const_reference front(const C& c) { return c.front(); }
+ reference back(C& c) { return c.back(); }
+ const_reference back(const C& c) { return c.back(); }
+
+ bool empty(const C& c) { return Container<C>::empty(c); }
+ iterator begin(C& c) { return Container<C>::begin(c); }
+ const_iterator begin(const C& c) { return Container<C>::begin(c); }
+ iterator end(C& c) { return Container<C>::end(c); }
+ const_iterator end(const C& c) { return Container<C>::end(c);
+}
+
+\end{itemdecl}
+
+
 \begin{itemdecl}
 auto concept FrontInsertionSequence<typename C> : SequenceContainer<C> {
   void C::push_front(const value_type&);


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