Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53275 - in trunk/libs/multi_index: doc example
From: joaquin_at_[hidden]
Date: 2009-05-26 04:59:50


Author: joaquin
Date: 2009-05-26 04:59:47 EDT (Tue, 26 May 2009)
New Revision: 53275
URL: http://svn.boost.org/trac/boost/changeset/53275

Log:
handcrafted the element type of the bimap example for the same reasons as explained in [53273]
Text files modified:
   trunk/libs/multi_index/doc/examples.html | 12 ++++++------
   trunk/libs/multi_index/example/bimap.cpp | 13 ++++++++++---
   2 files changed, 16 insertions(+), 9 deletions(-)

Modified: trunk/libs/multi_index/doc/examples.html
==============================================================================
--- trunk/libs/multi_index/doc/examples.html (original)
+++ trunk/libs/multi_index/doc/examples.html 2009-05-26 04:59:47 EDT (Tue, 26 May 2009)
@@ -104,10 +104,10 @@
 <p>
 This example shows how to construct a bidirectional map with
 <code>multi_index_container</code>. By a <i>bidirectional map</i> we mean
-a container of elements of <code>std::pair&lt;const FromType,const ToType></code>
-such that no two elements exists with the same <code>first</code>
-<i>or</i> <code>second</code> value (<code>std::map</code> only
-guarantees uniqueness of the first member). Fast lookup is provided
+a container of <code>(const FromType,const ToType)</code> pairs
+such that no two elements exists with the same first
+<i>or</i> second component (<code>std::map</code> only
+guarantees uniqueness of the first component). Fast lookup is provided
 for both keys. The program features a tiny Spanish-English
 dictionary with online query of words in both languages.
 </p>
@@ -450,9 +450,9 @@
 
 <br>
 
-<p>Revised July 16th 2007</p>
+<p>Revised May 26th 2009</p>
 
-<p>&copy; Copyright 2003-2007 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
+<p>&copy; Copyright 2003-2009 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
 Distributed under the Boost Software
 License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
 LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">

Modified: trunk/libs/multi_index/example/bimap.cpp
==============================================================================
--- trunk/libs/multi_index/example/bimap.cpp (original)
+++ trunk/libs/multi_index/example/bimap.cpp 2009-05-26 04:59:47 EDT (Tue, 26 May 2009)
@@ -1,6 +1,6 @@
 /* Boost.MultiIndex example of a bidirectional map.
  *
- * Copyright 2003-2008 Joaquin M Lopez Munoz.
+ * Copyright 2003-2009 Joaquin M Lopez Munoz.
  * Distributed under the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or copy at
  * http://www.boost.org/LICENSE_1_0.txt)
@@ -18,7 +18,6 @@
 #include <boost/multi_index/ordered_index.hpp>
 #include <iostream>
 #include <string>
-#include <utility>
 
 using boost::multi_index_container;
 using namespace boost::multi_index;
@@ -35,7 +34,15 @@
 template<typename FromType,typename ToType>
 struct bidirectional_map
 {
- typedef std::pair<FromType,ToType> value_type;
+ struct value_type
+ {
+ value_type(const FromType& first_,const ToType& second_):
+ first(first_),second(second_)
+ {}
+
+ FromType first;
+ ToType second;
+ };
 
 #if defined(BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS) ||\
     defined(BOOST_MSVC)&&(BOOST_MSVC<1300) ||\


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