Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61457 - sandbox/tokenmap/libs/tokenmap/doc
From: sl_at_[hidden]
Date: 2010-04-21 09:15:15


Author: sl_
Date: 2010-04-21 09:15:13 EDT (Wed, 21 Apr 2010)
New Revision: 61457
URL: http://svn.boost.org/trac/boost/changeset/61457

Log:
updated doc to reflect changes to the API (iterators)
Text files modified:
   sandbox/tokenmap/libs/tokenmap/doc/tokenmap.qbk | 35 ++++++++++++++++++++++++-----------
   1 files changed, 24 insertions(+), 11 deletions(-)

Modified: sandbox/tokenmap/libs/tokenmap/doc/tokenmap.qbk
==============================================================================
--- sandbox/tokenmap/libs/tokenmap/doc/tokenmap.qbk (original)
+++ sandbox/tokenmap/libs/tokenmap/doc/tokenmap.qbk 2010-04-21 09:15:13 EDT (Wed, 21 Apr 2010)
@@ -179,11 +179,10 @@
     #include <boost/tokenmap.hpp>
 
 Next, we define a `tokenmap` for storing strings. The following code creates an empty `tokenmap`
-container with initial capacity set to 10000, load factor set to 0.7 and current
-time as seed for pseudo-number generator:
+container with current time as seed for pseudo-number generator:
 
     typedef boost::tokenmap<std::string, unsigned int> tokenmap_type;
- tokenmap_type names( 10000, 0.7, time(NULL) );
+ tokenmap_type names( time(NULL) );
 
 To insert elements into the container we do:
 
@@ -229,14 +228,16 @@
 
       // Metadata
 
- typedef uint64_t hash_type;
- typedef key__ key_type;
- typedef value__ mapped_type;
- typedef std::pair<key_type, mapped_type*> value_type;
+ typedef unspecifed-integral-type hash_type;
+ typedef key__ key_type;
+ typedef value__ mapped_type;
+ typedef std::pair<key_type, mapped_type> value_type;
+ typedef unspecified-node-iterator iterator;
+ typedef unspecified-node-iterator reverse_iterator;
 
       // Constructor
 
- tokenmap(size_t capacity, float load_factor, hash_type seed);
+ explicit tokenmap(hash_type seed);
 
       // Destructor
 
@@ -252,11 +253,23 @@
 
       // Accessors
 
- mapped_type * find(key_type key) const;
+ iterator find(key_type key) const;
+
+ mapped_type * at(key_type key) const;
+
+ bool exists(key_type key) const;
 
       bool exists(key_type key) const;
 
       key_type size() const;
+
+ // Iterators.
+
+ iterator begin();
+ iterator end();
+
+ reverse_iterator rbegin();
+ reverse_iterator rend();
     };
 
     } // namespace tokenmaps
@@ -268,7 +281,7 @@
 
 [heading Constructors, copy and assignment]
 
- tokenmap(size_t capacity, float load_factor, hash_type seed);
+ explicit tokenmap(hash_type seed);
 
 * [*Effects:] Constructs an empty `tokenmap`.
 * [*Complexity:] Constant.
@@ -279,7 +292,7 @@
 
 (this section requires far more work)
 
-Below is a comparison of insertions and lookups, compiled with gcc 4.4.1:
+Below is a comparison of insertions and lookups, compiled with gcc 4.4.1. Lookups were done with 1,000,000 elements in each container.
 
     typedef map<token, session*> map_type;
     typedef tokenmap<session, uint32_t> token_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