summaryrefslogtreecommitdiff
path: root/boost/bimap/relation/support
diff options
context:
space:
mode:
Diffstat (limited to 'boost/bimap/relation/support')
-rw-r--r--boost/bimap/relation/support/data_extractor.hpp110
-rw-r--r--boost/bimap/relation/support/get.hpp140
-rw-r--r--boost/bimap/relation/support/get_pair_functor.hpp85
-rw-r--r--boost/bimap/relation/support/is_tag_of_member_at.hpp181
-rw-r--r--boost/bimap/relation/support/member_with_tag.hpp180
-rw-r--r--boost/bimap/relation/support/opposite_tag.hpp61
-rw-r--r--boost/bimap/relation/support/pair_by.hpp120
-rw-r--r--boost/bimap/relation/support/pair_type_by.hpp62
-rw-r--r--boost/bimap/relation/support/value_type_of.hpp91
9 files changed, 1030 insertions, 0 deletions
diff --git a/boost/bimap/relation/support/data_extractor.hpp b/boost/bimap/relation/support/data_extractor.hpp
new file mode 100644
index 0000000000..eab2db7ac8
--- /dev/null
+++ b/boost/bimap/relation/support/data_extractor.hpp
@@ -0,0 +1,110 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// 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)
+
+/// \file relation/support/data_extractor.hpp
+/// \brief Data extraction functor.
+
+#ifndef BOOST_BIMAP_RELATION_SUPPORT_DATA_EXTRACTOR_HPP
+#define BOOST_BIMAP_RELATION_SUPPORT_DATA_EXTRACTOR_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#include <boost/bimap/relation/detail/metadata_access_builder.hpp>
+#include <functional>
+
+/** \struct boost::bimaps::relation::support::data_extractor
+
+\brief Data extraction functor.
+
+\ingroup relation_group
+ **/
+
+#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+template< class Tag, class Relation >
+struct data_extractor_implementation;
+
+template< class Relation >
+struct data_extractor_implementation< member_at::left, Relation > :
+ public std::unary_function<Relation,BOOST_DEDUCED_TYPENAME Relation::left_value_type>
+{
+ BOOST_DEDUCED_TYPENAME Relation::left_value_type const &
+ operator()(Relation const & rel) const
+ {
+ return rel.left;
+ }
+
+ BOOST_DEDUCED_TYPENAME Relation::left_value_type &
+ operator()(Relation & rel) const
+ {
+ return rel.left;
+ }
+};
+
+template< class Relation >
+struct data_extractor_implementation< member_at::right, Relation > :
+ public std::unary_function<Relation,BOOST_DEDUCED_TYPENAME Relation::right_value_type>
+{
+ BOOST_DEDUCED_TYPENAME Relation::right_value_type const &
+ operator()(Relation const & rel) const
+ {
+ return rel.right;
+ }
+
+ BOOST_DEDUCED_TYPENAME Relation::right_value_type &
+ operator()(Relation & rel) const
+ {
+ return rel.right;
+ }
+};
+
+template< class Tag, class Relation >
+struct data_extractor
+{
+ typedef data_extractor_implementation
+ <
+ BOOST_DEDUCED_TYPENAME member_with_tag<Tag,Relation>::type,
+ Relation
+
+ > type;
+};
+
+template< class Relation >
+struct both_keys_extractor
+{
+ typedef BOOST_DEDUCED_TYPENAME Relation::storage_base result_type;
+
+ const result_type & operator()(const Relation & rel) const
+ {
+ return rel;
+ }
+
+ result_type & operator()( Relation & rel) const
+ {
+ return rel;
+ }
+};
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+#endif // BOOST_BIMAP_RELATION_SUPPORT_DATA_EXTRACTOR_HPP
+
diff --git a/boost/bimap/relation/support/get.hpp b/boost/bimap/relation/support/get.hpp
new file mode 100644
index 0000000000..3a3afde15d
--- /dev/null
+++ b/boost/bimap/relation/support/get.hpp
@@ -0,0 +1,140 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// 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)
+
+/// \file relation/support/get.hpp
+/// \brief get<tag>(r) function
+
+#ifndef BOOST_BIMAP_RELATION_SUPPORT_GET_HPP
+#define BOOST_BIMAP_RELATION_SUPPORT_GET_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#include <boost/bimap/relation/support/value_type_of.hpp>
+
+#include <boost/bimap/relation/detail/access_builder.hpp>
+
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_const.hpp>
+
+#ifdef BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
+
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+/** \brief Gets a pair view of the relation.
+
+\ingroup relation_group
+ **/
+
+template< class Tag, class SymmetricType >
+BOOST_DEDUCED_TYPENAME result_of::get<Tag,SymmetricType>::type
+ get( SymmetricType & );
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+#endif // BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
+
+
+
+#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+// Since it is very error-prone to directly write the hole bunch
+// of relation accesor. They are buil from litle macro blocks that
+// are both more readable, leading to self docummenting code and a
+// lot more easier to understand and mantain.
+// It is very important to note that the three building blocks have
+// to laid in the same namespace in order to work. There is also
+// important to keep them in order.
+// The forward declaration are not necesary but they help a lot to
+// the reader, as they undercover what is the signature of the
+// result code.
+// In the end, it is not quicker to do it in this way because you
+// write a lot. But this code has no complexity at all and almost
+// every word writed is for documentation.
+
+// Result of
+// -------------------------------------------------------------------------
+/*
+ namespace result_of {
+
+ template< class Tag, class Relation >
+ struct get<Tag,Relation>;
+ {
+ typedef -unspecified- type;
+ };
+
+ } // namespace result_of
+
+*/
+
+BOOST_BIMAP_SYMMETRIC_ACCESS_RESULT_OF_BUILDER
+(
+ get,
+ value_type_of
+)
+
+
+
+// Implementation
+// -------------------------------------------------------------------------
+
+BOOST_BIMAP_SYMMETRIC_ACCESS_IMPLEMENTATION_BUILDER
+(
+ get,
+ SymmetricType,
+ st,
+ return st.get_left(),
+ return st.get_right()
+)
+
+namespace detail {
+
+template< class SymmetricType >
+BOOST_DEDUCED_TYPENAME result_of::get<
+ ::boost::bimaps::relation::member_at::info, SymmetricType >::type
+get(::boost::bimaps::relation::member_at::info, SymmetricType & rel)
+{
+ return rel.info;
+}
+
+} // namespace detail
+
+// Interface
+//----------------------------------------------------------------------------
+
+BOOST_BIMAP_SYMMETRIC_ACCESS_INTERFACE_BUILDER
+(
+ get
+)
+
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+#endif // BOOST_BIMAP_RELATION_SUPPORT_GET_HPP
+
diff --git a/boost/bimap/relation/support/get_pair_functor.hpp b/boost/bimap/relation/support/get_pair_functor.hpp
new file mode 100644
index 0000000000..5f37bf6cfe
--- /dev/null
+++ b/boost/bimap/relation/support/get_pair_functor.hpp
@@ -0,0 +1,85 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// 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)
+
+/// \file relation/support/get_pair_functor.hpp
+/// \brief get_pair_functor definition
+
+#ifndef BOOST_BIMAP_RELATION_SUPPORT_GET_PAIR_FUNCTOR_HPP
+#define BOOST_BIMAP_RELATION_SUPPORT_GET_PAIR_FUNCTOR_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#include <boost/bimap/relation/support/pair_by.hpp>
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+/// \brief A Functor that takes a relation as a parameter an return the desired view.
+/**
+
+This functor is included to help users of the relation class when using
+stl algorithms.
+
+See also member_at, pair_by().
+\ingroup relation_group
+
+ **/
+
+template< class Tag, class Relation >
+struct get_pair_functor
+{
+ BOOST_DEDUCED_TYPENAME result_of::pair_by<Tag,Relation>::type
+ operator()( Relation & r ) const
+ {
+ return pair_by<Tag>(r);
+ }
+
+ BOOST_DEDUCED_TYPENAME result_of::pair_by<Tag,const Relation>::type
+ operator()( const Relation & r ) const
+ {
+ return pair_by<Tag>(r);
+ }
+};
+
+
+/// \brief A Functor that takes a relation as a parameter an return the above view.
+/**
+
+\ingroup relation_group
+ **/
+
+template< class Relation >
+struct get_above_view_functor
+{
+ BOOST_DEDUCED_TYPENAME Relation::above_view &
+ operator()( Relation & r ) const
+ {
+ return r.get_view();
+ }
+
+ const BOOST_DEDUCED_TYPENAME Relation::above_view &
+ operator()( const Relation & r ) const
+ {
+ return r.get_view();
+ }
+};
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+
+#endif // BOOST_BIMAP_RELATION_SUPPORT_GET_PAIR_FUNCTOR_HPP
+
diff --git a/boost/bimap/relation/support/is_tag_of_member_at.hpp b/boost/bimap/relation/support/is_tag_of_member_at.hpp
new file mode 100644
index 0000000000..b2b1b7497b
--- /dev/null
+++ b/boost/bimap/relation/support/is_tag_of_member_at.hpp
@@ -0,0 +1,181 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// 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)
+
+/// \file relation/support/is_tag_of_member_at.hpp
+/// \brief is_tag_of_member_at<tag,relation> metafunction
+
+#ifndef BOOST_BIMAP_RELATION_SUPPORT_IS_TAG_OF_MEMBER_AT_HPP
+#define BOOST_BIMAP_RELATION_SUPPORT_IS_TAG_OF_MEMBER_AT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#include <boost/bimap/relation/member_at.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/bimap/relation/support/member_with_tag.hpp>
+
+/** \struct boost::bimaps::relation::support::is_tag_of_member_at_left
+
+\brief Metafunction to test if a user tag is refering to the left member.
+
+\code
+
+template< class Tag, class Relation >
+struct is_tag_of_member_at_left : {true_|false_} {};
+
+\endcode
+
+This metafunction is somewhat redundant with member_with_tag, but it is included
+because it is a lot easier to metaprogram with it. The result type is the
+same that:
+
+\code
+
+ is_same< member_with_tag<Tag,Relation>::type , member_at::left >::type
+
+\endcode
+
+See also member_with_tag, member_at, is_tag_of_member_at_right.
+\ingroup relation_group
+ **/
+
+
+/** \struct boost::bimaps::relation::support::is_tag_of_member_at_right
+
+\brief Metafunction to test if a user tag is refering to the left member.
+
+\code
+
+template< class Tag, class Relation >
+struct is_tag_of_member_at_right : {true_|false_} {};
+
+\endcode
+
+This metafunction is somewhat redundat with member_with_tag, but it is included
+because it is a lot easier to metaprogram with it. The result type is the
+same that:
+
+\code
+
+ is_same< member_with_tag<Tag,Relation>::type , member_at::right >::type
+
+\endcode
+
+See also member_with_tag, member_at, is_tag_of_member_at_left.
+\ingroup relation_group
+ **/
+
+
+#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+// Metafunction is_tag_of_member_at_left
+// Easiear metaprogramming
+
+template
+<
+ class Tag,
+ class Relation,
+ class Enable = void
+>
+struct is_tag_of_member_at_left :
+ ::boost::mpl::false_ {};
+
+template< class Tag, class Relation >
+struct is_tag_of_member_at_left
+<
+ Tag, Relation,
+ BOOST_DEDUCED_TYPENAME enable_if
+ <
+ is_same
+ <
+ BOOST_DEDUCED_TYPENAME member_with_tag<Tag,Relation>::type,
+ member_at::left
+ >
+
+ >::type
+> :
+ ::boost::mpl::true_ {};
+
+// Metafunction is_tag_of_member_at_right
+// Easiear metaprogramming
+
+template
+<
+ class Tag,
+ class Relation,
+ class Enable = void
+>
+struct is_tag_of_member_at_right :
+ ::boost::mpl::false_ {};
+
+template< class Tag, class Relation >
+struct is_tag_of_member_at_right
+<
+ Tag, Relation,
+ BOOST_DEDUCED_TYPENAME enable_if
+ <
+ is_same
+ <
+ BOOST_DEDUCED_TYPENAME member_with_tag<Tag,Relation>::type,
+ member_at::right
+ >
+
+ >::type
+> :
+ ::boost::mpl::true_ {};
+
+
+// Metafunction is_tag_of_member_at_info
+// Easiear metaprogramming
+
+template
+<
+ class Tag,
+ class Relation,
+ class Enable = void
+>
+struct is_tag_of_member_at_info :
+ ::boost::mpl::false_ {};
+
+template< class Tag, class Relation >
+struct is_tag_of_member_at_info
+<
+ Tag, Relation,
+ BOOST_DEDUCED_TYPENAME enable_if
+ <
+ is_same
+ <
+ BOOST_DEDUCED_TYPENAME member_with_tag<Tag,Relation>::type,
+ member_at::info
+ >
+
+ >::type
+> :
+ ::boost::mpl::true_ {};
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+#endif // BOOST_BIMAP_RELATION_SUPPORT_IS_TAG_OF_MEMBER_AT_HPP
+
+
diff --git a/boost/bimap/relation/support/member_with_tag.hpp b/boost/bimap/relation/support/member_with_tag.hpp
new file mode 100644
index 0000000000..a8324ff281
--- /dev/null
+++ b/boost/bimap/relation/support/member_with_tag.hpp
@@ -0,0 +1,180 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// 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)
+
+/// \file relation/support/member_with_tag.hpp
+/// \brief member_with_tag<tag,relation> metafunction
+
+#ifndef BOOST_BIMAP_RELATION_SUPPORT_MEMBER_WITH_TAG_HPP
+#define BOOST_BIMAP_RELATION_SUPPORT_MEMBER_WITH_TAG_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#include <boost/bimap/relation/member_at.hpp>
+#include <boost/bimap/detail/debug/static_error.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/and.hpp>
+
+/** \struct boost::bimaps::relation::support::member_with_tag
+
+\brief Metafunction to convert user tags to the member_at idiom.
+
+\code
+
+template< class Tag, class Relation >
+struct member_with_tag
+{
+ typedef member_at::{side} type;
+};
+
+\endcode
+
+We have to allow that all the metafunctions that works with tags
+and retrieves data from a Relation will work with member_at idiom
+even if the type was tagged. This will be great for the user,
+because he can choose to tag a member after he is using the
+relation and the code will still work.
+
+If we perform this check in every metafunction it will be very
+tedious and error prone, so instead of that all metafunctions
+that works with relations first call this metafunction that
+convert the tag to a member_at tag.
+
+See also member_at, is_tag_of_member_at_left, is_tag_of_member_at_right.
+\ingroup relation_group
+ **/
+
+#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+template
+<
+ class Tag,
+ class Relation,
+ class Enable = void
+>
+struct member_with_tag
+{
+ BOOST_BIMAP_STATIC_ERROR( MEMBER_WITH_TAG_FAILURE, (Relation,Tag) );
+};
+
+template< class Relation >
+struct member_with_tag
+<
+ member_at::left, Relation, void
+>
+{
+ typedef member_at::left type;
+};
+
+template< class Relation >
+struct member_with_tag
+<
+ member_at::right, Relation, void
+>
+{
+ typedef member_at::right type;
+};
+
+template< class Relation >
+struct member_with_tag
+<
+ member_at::info, Relation, void
+>
+{
+ typedef member_at::info type;
+};
+
+
+template< class Tag, class Relation >
+struct member_with_tag
+<
+ Tag, Relation,
+ BOOST_DEDUCED_TYPENAME enable_if
+ <
+ mpl::and_
+ <
+ mpl::not_< is_same<Tag,member_at::left> >,
+ is_same
+ <
+ Tag,
+ BOOST_DEDUCED_TYPENAME Relation::left_tag
+ >
+ >
+
+ >::type
+>
+{
+ typedef member_at::left type;
+};
+
+template< class Tag, class Relation >
+struct member_with_tag
+<
+ Tag,
+ Relation,
+ BOOST_DEDUCED_TYPENAME enable_if
+ <
+ mpl::and_
+ <
+ mpl::not_< is_same<Tag,member_at::right> >,
+ is_same
+ <
+ Tag,
+ BOOST_DEDUCED_TYPENAME Relation::right_tag
+ >
+ >
+
+ >::type
+>
+{
+ typedef member_at::right type;
+};
+
+template< class Tag, class Relation >
+struct member_with_tag
+<
+ Tag, Relation,
+ BOOST_DEDUCED_TYPENAME enable_if
+ <
+ mpl::and_
+ <
+ mpl::not_< is_same<Tag,member_at::info> >,
+ is_same
+ <
+ Tag,
+ BOOST_DEDUCED_TYPENAME Relation::info_tag
+ >
+ >
+
+ >::type
+>
+{
+ typedef member_at::info type;
+};
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+#endif // BOOST_BIMAP_RELATION_SUPPORT_MEMBER_WITH_TAG_HPP
+
+
diff --git a/boost/bimap/relation/support/opposite_tag.hpp b/boost/bimap/relation/support/opposite_tag.hpp
new file mode 100644
index 0000000000..174bd985c0
--- /dev/null
+++ b/boost/bimap/relation/support/opposite_tag.hpp
@@ -0,0 +1,61 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// 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)
+
+/// \file relation/support/opposite_tag.hpp
+/// \brief Metafunction to obtain the opposite tag in a relation.
+
+#ifndef BOOST_BIMAP_RELATION_SUPPORT_OPPOSITE_TAG_HPP
+#define BOOST_BIMAP_RELATION_SUPPORT_OPPOSITE_TAG_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#include <boost/bimap/relation/detail/metadata_access_builder.hpp>
+
+/** \struct boost::bimaps::relation::support::opposite_tag
+
+\brief Metafunction to obtain the opposite tag in a relation.
+
+\code
+
+template< class Tag, class Relation >
+struct opposite_tag
+{
+ typedef {OppositeTag} type;
+};
+
+\endcode
+
+\ingroup relation_group
+ **/
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+// Implementation of const pair reference type by metafunction
+
+BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER
+(
+ opossite_tag,
+ right_tag,
+ left_tag
+)
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+
+#endif // BOOST_BIMAP_RELATION_SUPPORT_OPPOSITE_TAG_HPP
+
diff --git a/boost/bimap/relation/support/pair_by.hpp b/boost/bimap/relation/support/pair_by.hpp
new file mode 100644
index 0000000000..1ce25fbe5c
--- /dev/null
+++ b/boost/bimap/relation/support/pair_by.hpp
@@ -0,0 +1,120 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// 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)
+
+/// \file relation/support/pair_by.hpp
+/// \brief pair_by<member>(r) function
+
+#ifndef BOOST_BIMAP_RELATION_SUPPORT_PAIR_BY_HPP
+#define BOOST_BIMAP_RELATION_SUPPORT_PAIR_BY_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#include <boost/bimap/relation/support/pair_type_by.hpp>
+#include <boost/bimap/relation/detail/access_builder.hpp>
+
+#ifdef BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+/** \brief Gets a pair view of the relation.
+
+\ingroup relation_group
+ **/
+
+template< class Tag, class Relation >
+BOOST_DEDUCED_TYPENAME result_of::pair_by<Tag,Relation>::type
+ pair_by( Relation & rel );
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+#endif // BOOST_BIMAP_ONLY_DOXYGEN_WILL_PROCESS_THE_FOLLOWING_LINES
+
+
+#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+
+// Since it is very error-prone to directly write the hole bunch
+// of relation accesor. They are buil from litle macro blocks that
+// are both more readable, leading to self docummenting code and a
+// lot more easier to understand and mantain.
+// It is very important to note that the three building blocks have
+// to laid in the same namespace in order to work. There is also
+// important to keep them in order.
+// The forward declaration are not necesary but they help a lot to
+// the reader, as they undercover what is the signature of the
+// result code.
+// In the end, it is not quicker to do it in this way because you
+// write a lot. But this code has no complexity at all and almost
+// every word writed is for documentation.
+
+// Result of
+// -------------------------------------------------------------------------
+/*
+ namespace result_of {
+
+ template< class Tag, class Relation >
+ struct pair_by<Tag,Relation>;
+ {
+ typedef -unspecified- type;
+ };
+
+ } // namespace result_of
+*/
+
+BOOST_BIMAP_SYMMETRIC_ACCESS_RESULT_OF_BUILDER
+(
+ pair_by,
+ pair_type_by
+)
+
+
+
+// Implementation
+// -------------------------------------------------------------------------
+
+BOOST_BIMAP_SYMMETRIC_ACCESS_IMPLEMENTATION_BUILDER
+(
+ pair_by,
+ Relation,
+ rel,
+ return rel.get_left_pair(),
+ return rel.get_right_pair()
+)
+
+// Interface
+// --------------------------------------------------------------------------
+
+BOOST_BIMAP_SYMMETRIC_ACCESS_INTERFACE_BUILDER
+(
+ pair_by
+)
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+
+#endif // BOOST_BIMAP_DOXIGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
+
+#endif // BOOST_BIMAP_RELATION_SUPPORT_PAIR_BY_HPP
diff --git a/boost/bimap/relation/support/pair_type_by.hpp b/boost/bimap/relation/support/pair_type_by.hpp
new file mode 100644
index 0000000000..64f98d1ecc
--- /dev/null
+++ b/boost/bimap/relation/support/pair_type_by.hpp
@@ -0,0 +1,62 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// 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)
+
+/// \file relation/support/pair_type_by.hpp
+/// \brief pair_type_by<tag,relation> metafunction
+
+#ifndef BOOST_BIMAP_RELATION_SUPPORT_PAIR_TYPE_BY_HPP
+#define BOOST_BIMAP_RELATION_SUPPORT_PAIR_TYPE_BY_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#include <boost/bimap/relation/detail/metadata_access_builder.hpp>
+
+/** \struct boost::bimaps::relation::support::pair_type_by
+
+\brief Metafunction to obtain the view type indexed by one of the sides.
+
+\code
+
+template< class Tag, class Relation >
+struct pair_type_by
+{
+ typedef {signature-compatible with std::pair} type;
+};
+
+\endcode
+
+See also member_at, pair_by().
+\ingroup relation_group
+ **/
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+// Implementation of pair type by metafunction
+
+BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER
+(
+ pair_type_by,
+ left_pair,
+ right_pair
+)
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+
+#endif // BOOST_BIMAP_RELATION_SUPPORT_PAIR_BY_TYPE_HPP
+
diff --git a/boost/bimap/relation/support/value_type_of.hpp b/boost/bimap/relation/support/value_type_of.hpp
new file mode 100644
index 0000000000..9dc5761119
--- /dev/null
+++ b/boost/bimap/relation/support/value_type_of.hpp
@@ -0,0 +1,91 @@
+// Boost.Bimap
+//
+// Copyright (c) 2006-2007 Matias Capeletto
+//
+// 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)
+
+/// \file relation/support/value_type_of.hpp
+/// \brief value_type_of<tag,relation> metafunction
+
+#ifndef BOOST_BIMAP_RELATION_SUPPORT_VALUE_TYPE_OF_HPP
+#define BOOST_BIMAP_RELATION_SUPPORT_VALUE_TYPE_OF_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+
+#include <boost/bimap/relation/detail/metadata_access_builder.hpp>
+
+/** \struct boost::bimaps::relation::support::value_type_of
+
+\brief Metafunction to obtain the value type of one of the sides.
+
+\code
+
+template< class Tag, class Relation >
+struct value_type_of
+{
+ typedef typename Relation::{side}_type type;
+};
+
+\endcode
+
+See also member_at, get().
+\ingroup relation_group
+ **/
+
+namespace boost {
+namespace bimaps {
+namespace relation {
+namespace support {
+
+// Metafunction value_type_of
+/*
+
+ template< class Tag, class Relation >
+ struct value_type_of
+ {
+ typedef -unspecified- type;
+ };
+
+*/
+
+BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER
+(
+ value_type_of,
+ left_value_type,
+ right_value_type
+)
+
+// Add support for info tags to value_type_of
+
+template< class Tag, class SymmetricType >
+struct value_type_of
+<
+ Tag, SymmetricType,
+ BOOST_DEDUCED_TYPENAME enable_if
+ <
+ ::boost::bimaps::relation::support::is_tag_of_member_at_info
+ <
+ Tag,
+ SymmetricType
+ >
+
+ >::type
+>
+{
+ typedef BOOST_DEDUCED_TYPENAME SymmetricType::info_type type;
+};
+
+} // namespace support
+} // namespace relation
+} // namespace bimaps
+} // namespace boost
+
+
+#endif // BOOST_BIMAP_RELATION_SUPPORT_VALUE_TYPE_OF_HPP
+