Boost logo

Boost-Commit :

From: asutton_at_[hidden]
Date: 2007-08-20 20:52:04


Author: asutton
Date: 2007-08-20 20:52:04 EDT (Mon, 20 Aug 2007)
New Revision: 38812
URL: http://svn.boost.org/trac/boost/changeset/38812

Log:
Slowly adding more docs

Text files modified:
   sandbox/boost_docs/trunk/libs/standard/doc/concepts/containers/container.qbk | 34 ++++++++++++++++++++-----
   sandbox/boost_docs/trunk/libs/standard/doc/concepts/containers/forward_container.qbk | 53 ++++++++++++++++++++++++++++++++++++++++
   2 files changed, 80 insertions(+), 7 deletions(-)

Modified: sandbox/boost_docs/trunk/libs/standard/doc/concepts/containers/container.qbk
==============================================================================
--- sandbox/boost_docs/trunk/libs/standard/doc/concepts/containers/container.qbk (original)
+++ sandbox/boost_docs/trunk/libs/standard/doc/concepts/containers/container.qbk 2007-08-20 20:52:04 EDT (Mon, 20 Aug 2007)
@@ -22,7 +22,7 @@
     [[Expression] [Description]]
     [[`C`] [A type that models the [StdContainer] concept.]]
     [[`c`, `d`] [Objects of type `C`.]]
- [[`T`] [An object stored by `C`.]]
+ [[`T`] [The type of an object stored by `C`.]]
 ]
 
 [heading Associated Types]
@@ -62,8 +62,8 @@
             The type of object used to iterate over elements of `C`.
             The iterator type is convertible to the const iterator type.
             
- *Requirements:* The iterator type may not be a model of the
- [StdOutputIterator] concept.
+ *Requirements:* This type models any [StdIterator] concept except
+ [StdOutputIterator].
         ]
     ]
     [
@@ -73,8 +73,8 @@
         [
             The type of object used to iterate over elements of `C`.
             
- *Requirements:* The iterator type may not be a model of the
- [StdOutputIterator] concept.
+ *Requirements:* This type models any [StdIterator] concept except
+ [StdOutputIterator].
         ]
     ]
 ]
@@ -213,11 +213,31 @@
 ]
 
 [heading Examples]
+A type `C` is required to be a container if it explicitly refers to any of
+its associated types or calls any of its member functions.
 
+ // Accessing the size of a container of type C requires that type
+ // to model the Container concept.
     template <typename C>
- typename C::size_type container_size()
+ typename C::size_type container_size(const C& c)
     {
         return c.size();
     }
-
+
+ // Accessing the begin() and end() iterator ranges of a container
+ // of type C requires that type to model the Container concept.
+ template <typename C>
+ std::pair<C::iterator, C::iterator> container_range(C& c)
+ {
+ return std::make_pair(c.begin(), c.end());
+ }
+
+ // Testing whether a container of type C is empty() requires
+ // that type to model the Container concept.
+ template <typename C>
+ bool container_empty(const C& c)
+ {
+ return c.empty();
+ }
+
 [endsect]
\ No newline at end of file

Modified: sandbox/boost_docs/trunk/libs/standard/doc/concepts/containers/forward_container.qbk
==============================================================================
--- sandbox/boost_docs/trunk/libs/standard/doc/concepts/containers/forward_container.qbk (original)
+++ sandbox/boost_docs/trunk/libs/standard/doc/concepts/containers/forward_container.qbk 2007-08-20 20:52:04 EDT (Mon, 20 Aug 2007)
@@ -6,5 +6,58 @@
  /]
 
 [section Forward Container]
+A type `C` is a /forward container/ if an object of type `C` is a [StdContainer]
+that stores its objects in a definite order, and the order of objects do not
+spontaneously change from iteration to iteration. The definite ordering of objects
+within the forward container allows the definition of equality and lexicographical
+ordering (if the contained type is [StdEqualityComparable] and [StdLessThanComparable]
+respectively).
+
+[heading Refinement Of]
+[StdEqualityComparable], [StdLessThanComparable], [StdContainer]
+
+[heading Notation]
+[table
+ [[Expression] [Description]]
+ [[`C`] [A type that models the [StdContainer] concept.]]
+ [[`c`, `d`] [Objects of type `C`.]]
+ [[`T`] [The type of an object stored by `C`.]]
+]
+
+[heading Requirements]
+[table
+ [[Name] [Expression] [Result Type] [Description]]
+ [
+ [Equality Comparison]
+ [
+ `c == d`
+ ]
+ [Convertible to `bool`]
+ [
+ Returns `true` if the container `c` is element-wise equivalent
+ to `d`.
+
+ *Requirements:* The type of stored objects `T` is [StdEqualityComparable].
+
+ *Complexity:* Linear in `c.size()`.
+ ]
+ ]
+ [
+ [Less-Than Comparison]
+ [
+ `c < d`
+ ]
+ [Convertible to `bool`]
+ [
+ Returns `true` if the container `c` is element-wise less-than `d`.
+
+ *Requirements:* The type of stored objects `T` is [StdLessThanComparable].
+
+ *Complexity:* Linear in `c.size()`.
+ ]
+ ]
+]
+
+[heading Examples]
 
 [endsect]
\ No newline at end of file


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