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

PrevUpHomeNext

select_relation Struct Template Reference
[relation]

Abstraction of a related pair of values, that extends the std::pair class. More...

#include <relation.hpp>

List of all members.

Public Types

typedef BOOST_DEDUCED_TYPENAME
mpl::if_< ::boost::bimaps::relation::detail::is_mutant_idiom_supported_for<
TA, TB >, mutant_relation<
TA, TB, force_mutable >,
standard_relation< TA, TB,
force_mutable > >::type 
type


Detailed Description

template<class TA, class TB, bool force_mutable = false>
struct boost::bimaps::relation::select_relation< TA, TB, force_mutable >

Abstraction of a related pair of values, that extends the std::pair class.

A select_relation<X,Y>::type has to be viewed in the following way: x is related with y and y is related with x.

            __________             __________
           |          |           |          |
           |          |           |          |
           |    X     | <-------> |    Y     |
           |          |           |          |
           |__________|           |__________|

              left                  right

By no means a relation imposes a ordering between the data. This is the main difference with the concept of a pair in the std library. If used with tags you can even exchange the left and right parameter in the template definition and all the code will continue working.

If not tags are used, the first/second members are replaced by the more symetric approach: member_at::left and member_at::right.

Note:
Even when user tags are specified the member_at idiom still works.
With the actual standard, the optimal implementation is not ANSI compliant. However most compilers support it so this metafunction check if the compiler will do the right thing with the layout of each class and if the mutant idiom is supported. If this is the case mutant_relation will be used. If it is not supported then standard_relation, a suboptimasl approach based in references will be used. Using this metafunction is compliante with the standard and optimal for each compiler.

See also mutant_relation, standard_relation, member_at, get(), value_type_of, pair_by(), pair_type_by.

Definition at line 176 of file relation.hpp.


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

PrevUpHomeNext