Boost C++ Libraries Boost.Bimap Home Libraries People FAQ More

PrevUpHomeNext

bimap Class Template Reference

The bimap class is the entry point to the library. More...

#include <bimap.hpp>

Inheritance diagram for bimap:

Inheritance graph
Collaboration diagram for bimap:

Collaboration graph
List of all members.

Public Types

typedef bimap_core bimap_core_
typedef multi_index::multi_index_container<
relation, core_indices, BOOST_DEDUCED_TYPENAME
parameters::allocator::BOOST_NESTED_TEMPLATE
rebind< relation >::other > 
core_type
typedef ::boost::bimaps::detail::const_map_view_iterator<
left_tag, relation, left_core_const_iterator
left_const_iterator
typedef BOOST_DEDUCED_TYPENAME
left_index::const_iterator 
left_core_const_iterator
typedef BOOST_DEDUCED_TYPENAME
left_index::iterator 
left_core_iterator
typedef right_key_type left_data_type
typedef BOOST_DEDUCED_TYPENAME::boost::multi_index::index<
core_type, logic_left_tag
>::type 
left_index
typedef ::boost::bimaps::detail::map_view_iterator<
left_tag, relation, left_core_iterator
left_iterator
typedef BOOST_DEDUCED_TYPENAME
left_set_type::value_type 
left_key_type
typedef BOOST_DEDUCED_TYPENAME
left_set_type::BOOST_NESTED_TEMPLATE
map_view_bind< BOOST_DEDUCED_TYPENAME
base_::left_tag, base_
>::type 
left_map
typedef BOOST_DEDUCED_TYPENAME
base_::left_set_type 
left_set_type
typedef BOOST_DEDUCED_TYPENAME
left_tagged_set_type::tag 
left_tag
typedef BOOST_DEDUCED_TYPENAME
relation::left_pair 
left_value_type
typedef BOOST_DEDUCED_TYPENAME::boost::bimaps::relation::select_relation<
::boost::bimaps::tags::tagged<
BOOST_DEDUCED_TYPENAME mpl::if_<
mpl::and_< BOOST_DEDUCED_TYPENAME
left_set_type::mutable_key,
BOOST_DEDUCED_TYPENAME parameters::set_type_of_relation::left_mutable_key >,
left_key_type, BOOST_DEDUCED_TYPENAME::boost::add_const<
left_key_type >::type
>::type, left_tag >,::boost::bimaps::tags::tagged<
BOOST_DEDUCED_TYPENAME mpl::if_<
mpl::and_< BOOST_DEDUCED_TYPENAME
right_set_type::mutable_key,
BOOST_DEDUCED_TYPENAME parameters::set_type_of_relation::right_mutable_key >,
right_key_type, BOOST_DEDUCED_TYPENAME::boost::add_const <
right_key_type >::type
>::type, right_tag >, true
>::type 
relation
 Relation type stored by the bimap.
typedef BOOST_DEDUCED_TYPENAME
relation_set_type_of::BOOST_NESTED_TEMPLATE
set_view_bind< relation_set_core_index
>::type 
relation_set
typedef BOOST_DEDUCED_TYPENAME::boost::multi_index::index<
core_type, logic_relation_set_tag
>::type 
relation_set_core_index
typedef ::boost::bimaps::detail::const_map_view_iterator<
right_tag, relation, right_core_const_iterator
right_const_iterator
typedef BOOST_DEDUCED_TYPENAME
right_index::const_iterator 
right_core_const_iterator
typedef BOOST_DEDUCED_TYPENAME
right_index::iterator 
right_core_iterator
typedef left_key_type right_data_type
typedef BOOST_DEDUCED_TYPENAME::boost::multi_index::index<
core_type, logic_right_tag
>::type 
right_index
typedef ::boost::bimaps::detail::map_view_iterator<
right_tag, relation, right_core_iterator
right_iterator
typedef BOOST_DEDUCED_TYPENAME
right_set_type::value_type 
right_key_type
typedef BOOST_DEDUCED_TYPENAME
right_set_type::BOOST_NESTED_TEMPLATE
map_view_bind< BOOST_DEDUCED_TYPENAME
base_::right_tag, base_
>::type 
right_map
typedef BOOST_DEDUCED_TYPENAME
base_::right_set_type 
right_set_type
typedef BOOST_DEDUCED_TYPENAME
right_tagged_set_type::tag 
right_tag
typedef BOOST_DEDUCED_TYPENAME
relation::right_pair 
right_value_type

Public Member Functions

 bimap (const bimap &x)
template<class InputIterator>
 bimap (InputIterator first, InputIterator last)
 bimap ()
template<class Tag>
const BOOST_DEDUCED_TYPENAME::boost::bimaps::support::map_type_by<
Tag, bimap >::type & 
by (BOOST_EXPLICIT_TEMPLATE_TYPE(Tag)) const
template<class Tag>
BOOST_DEDUCED_TYPENAME::boost::bimaps::support::map_type_by<
Tag, bimap >::type & 
by (BOOST_EXPLICIT_TEMPLATE_TYPE(Tag))
bimapoperator= (const bimap &x)
template<class Tag, class IteratorType>
BOOST_DEDUCED_TYPENAME::boost::bimaps::support::const_iterator_type_by<
Tag, bimap >::type 
project (IteratorType iter BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag)) const
template<class Tag, class IteratorType>
BOOST_DEDUCED_TYPENAME::boost::bimaps::support::iterator_type_by<
Tag, bimap >::type 
project (IteratorType iter BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))
template<class IteratorType>
BOOST_DEDUCED_TYPENAME base_::left_const_iterator project_left (IteratorType iter) const
template<class IteratorType>
BOOST_DEDUCED_TYPENAME base_::left_iterator project_left (IteratorType iter)
template<class IteratorType>
BOOST_DEDUCED_TYPENAME base_::right_const_iterator project_right (IteratorType iter) const
template<class IteratorType>
BOOST_DEDUCED_TYPENAME base_::right_iterator project_right (IteratorType iter)
template<class IteratorType>
BOOST_DEDUCED_TYPENAME base_::relation_set::const_iterator project_up (IteratorType iter) const
template<class IteratorType>
BOOST_DEDUCED_TYPENAME base_::relation_set::iterator project_up (IteratorType iter)

Public Attributes

left_map left
 Left map view.
right_map right
 Right map view.

Protected Types

typedef BOOST_DEDUCED_TYPENAME
mpl::if_< ::boost::bimaps::detail::is_unconstrained_set_of<
left_set_type >, BOOST_DEDUCED_TYPENAME
mpl::if_< ::boost::bimaps::detail::is_unconstrained_set_of<
right_set_type >, independent_index_tag,
right_tag >::type, left_tag
>::type 
logic_left_tag
typedef BOOST_DEDUCED_TYPENAME
mpl::if_< is_same< relation_set_tag,
independent_index_tag >,
BOOST_DEDUCED_TYPENAME mpl::if_<
::boost::bimaps::detail::is_unconstrained_set_of<
relation_set_type_of >, logic_left_tag,
independent_index_tag
>::type, BOOST_DEDUCED_TYPENAME
mpl::if_< is_same< BOOST_DEDUCED_TYPENAME
parameters::set_type_of_relation,
left_based >, logic_left_tag,
logic_right_tag >::type
>::type 
logic_relation_set_tag
typedef BOOST_DEDUCED_TYPENAME
mpl::if_< ::boost::bimaps::detail::is_unconstrained_set_of<
right_set_type >, BOOST_DEDUCED_TYPENAME
mpl::if_< ::boost::bimaps::detail::is_unconstrained_set_of<
left_set_type >, independent_index_tag,
left_tag >::type, right_tag
>::type 
logic_right_tag
typedef BOOST_DEDUCED_TYPENAME
tagged_set_of_relation_type::tag 
relation_set_tag
typedef BOOST_DEDUCED_TYPENAME
tagged_set_of_relation_type::value_type 
relation_set_type_of

Friends

class boost::serialization::access

Classes

struct  map_by

Detailed Description

template<class KeyTypeA, class KeyTypeB, class AP1 = ::boost::mpl::na, class AP2 = ::boost::mpl::na, class AP3 = ::boost::mpl::na>
class boost::bimaps::bimap< KeyTypeA, KeyTypeB, AP1, AP2, AP3 >

The bimap class is the entry point to the library.

This class manages the instantiation of the desired bimap type. As there are several types of bidirectional maps that can be created using it, the main job of it is to find the desired type. This is done using metaprogramming to obtain the relation type that will be stored, the map_view type of each side and the set_view type of the general relationship. The instantiation is kept simple using an extended standard set theory, where a bidirectional map type is defined by the set types it relates. For example, a bidirectional map that has multimap semantics viewed from both sides is defined by specifying that the two keys sets are of multiset_of<Key> type. This allows the bimap class to support seamingless N-N, 1-N, ordered/unordered and even vector-list types of mapping. The three last parameters are used to specify the set type of the relation, an inplace hooked data class and the allocator type. As a help to the bimap user, these parameters support default types but use a special idiom that allow them to be specified without interleaving the usual use_default keyword. The possible bimap instantiation are enumerated here: {Side}KeyType can be directly a type, this is default to set_of<{Side}KeyType>, or can be a {SetType}_of<Type> specification. Additionally this two parameters can be tagged to specify others tags instead of the usual member_at::{Side} ones.

 bimap<LeftKeyType,RightKeyType> 

 bimap<LeftKeyType,RightKeyType> 

 bimap<LeftKeyType,RightKeyType,SetOfRelationType> 

 bimap<LeftKeyType,RightKeyType,SetOfRelationType,Allocator> 

 bimap<LeftKeyType,RightKeyType,DataToHook> 

 bimap<LeftKeyType,RightKeyType,DataToHook,Allocator> 

 bimap<LeftKeyType,RightKeyType,SetOfRelationType,DataToHook> 

 bimap<LeftKeyType,RightKeyType,SetOfRelationType,DataToHook,Allocator> 

Definition at line 156 of file bimap.hpp.


The documentation for this class was generated from the following file:
Copyright 2006 Matias Capeletto

PrevUpHomeNext