mirror of
https://github.com/boostorg/multi_index.git
synced 2025-05-09 23:14:04 +00:00
handcrafted the element type of the bimap example for the same reasons as explained in [53273]
[SVN r53275]
This commit is contained in:
parent
a5210bff85
commit
436ea292c6
@ -104,10 +104,10 @@ See <a href="../example/bimap.cpp">source code</a>.
|
|||||||
<p>
|
<p>
|
||||||
This example shows how to construct a bidirectional map with
|
This example shows how to construct a bidirectional map with
|
||||||
<code>multi_index_container</code>. By a <i>bidirectional map</i> we mean
|
<code>multi_index_container</code>. By a <i>bidirectional map</i> we mean
|
||||||
a container of elements of <code>std::pair<const FromType,const ToType></code>
|
a container of <code>(const FromType,const ToType)</code> pairs
|
||||||
such that no two elements exists with the same <code>first</code>
|
such that no two elements exists with the same first
|
||||||
<i>or</i> <code>second</code> value (<code>std::map</code> only
|
<i>or</i> second component (<code>std::map</code> only
|
||||||
guarantees uniqueness of the first member). Fast lookup is provided
|
guarantees uniqueness of the first component). Fast lookup is provided
|
||||||
for both keys. The program features a tiny Spanish-English
|
for both keys. The program features a tiny Spanish-English
|
||||||
dictionary with online query of words in both languages.
|
dictionary with online query of words in both languages.
|
||||||
</p>
|
</p>
|
||||||
@ -450,9 +450,9 @@ Tests
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<p>Revised July 16th 2007</p>
|
<p>Revised May 26th 2009</p>
|
||||||
|
|
||||||
<p>© Copyright 2003-2007 Joaquín M López Muñoz.
|
<p>© Copyright 2003-2009 Joaquín M López Muñoz.
|
||||||
Distributed under the Boost Software
|
Distributed under the Boost Software
|
||||||
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
|
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">
|
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* Boost.MultiIndex example of a bidirectional map.
|
/* 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.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
* http://www.boost.org/LICENSE_1_0.txt)
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
@ -18,7 +18,6 @@
|
|||||||
#include <boost/multi_index/ordered_index.hpp>
|
#include <boost/multi_index/ordered_index.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
using boost::multi_index_container;
|
using boost::multi_index_container;
|
||||||
using namespace boost::multi_index;
|
using namespace boost::multi_index;
|
||||||
@ -35,7 +34,15 @@ struct to{};
|
|||||||
template<typename FromType,typename ToType>
|
template<typename FromType,typename ToType>
|
||||||
struct bidirectional_map
|
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) ||\
|
#if defined(BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS) ||\
|
||||||
defined(BOOST_MSVC)&&(BOOST_MSVC<1300) ||\
|
defined(BOOST_MSVC)&&(BOOST_MSVC<1300) ||\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user