Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,170 @@
// 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/detail/access_builder.hpp
/// \brief Define macros to help building metafunctions
#ifndef BOOST_BIMAP_RELATION_ACCESS_BUILDER_HPP
#define BOOST_BIMAP_RELATION_ACCESS_BUILDER_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/relation/support/member_with_tag.hpp>
#include <boost/bimap/relation/member_at.hpp>
#include <boost/call_traits.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/not.hpp>
#include <boost/utility/enable_if.hpp>
/******************************************************************************
BIMAP SYMMETRIC ACCESS RESULT OF
*******************************************************************************
namespace result_of {
template< class Tag, class SymmetricType >
struct NAME
{
typedef -unspecified- type;
};
} // namespace result_of
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_ACCESS_RESULT_OF_BUILDER( \
\
NAME, \
METAFUNCTION_BASE \
) \
\
namespace result_of { \
\
template< class Tag, class SymmetricType > \
struct NAME \
{ \
typedef BOOST_DEDUCED_TYPENAME METAFUNCTION_BASE \
< \
Tag,SymmetricType \
\
>::type value_type; \
\
typedef BOOST_DEDUCED_TYPENAME mpl::if_< is_const<SymmetricType>, \
\
BOOST_DEDUCED_TYPENAME call_traits<value_type>::const_reference, \
\
BOOST_DEDUCED_TYPENAME call_traits<value_type>::reference \
\
>::type type; \
}; \
\
}
/*===========================================================================*/
/******************************************************************************
BIMAP SYMMETRIC ACCESS IMPLEMENTATION
*******************************************************************************
namespace detail {
template< class Tag, class SymmetricType >
typename result_of::NAME<Tag,SymmetricType>::type
NAME( Tag , const Relation & );
} // namespace detail
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_ACCESS_IMPLEMENTATION_BUILDER( \
\
NAME, \
TP_SYMMETRIC, \
PARAMETER_NAME, \
LEFT_BODY, \
RIGHT_BODY \
) \
\
namespace detail { \
\
\
\
template< class TP_SYMMETRIC > \
BOOST_DEDUCED_TYPENAME result_of::NAME \
< \
::boost::bimaps::relation::member_at::left,TP_SYMMETRIC \
\
>::type \
\
NAME( ::boost::bimaps::relation::member_at::left, \
TP_SYMMETRIC & PARAMETER_NAME ) \
{ \
LEFT_BODY; \
} \
\
template< class TP_SYMMETRIC > \
BOOST_DEDUCED_TYPENAME result_of::NAME \
< \
::boost::bimaps::relation::member_at::right,TP_SYMMETRIC \
\
>::type \
\
NAME( ::boost::bimaps::relation::member_at::right, \
TP_SYMMETRIC & PARAMETER_NAME ) \
{ \
RIGHT_BODY; \
} \
\
}
/*===========================================================================*/
/******************************************************************************
BIMAP RELATION ACCESS INTERFACE
*******************************************************************************
template< class Tag, class SymmetricType >
typename result_of::NAME<Tag,SymmetricType>::type
NAME( const SymmetricType & );
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_ACCESS_INTERFACE_BUILDER( \
\
NAME \
) \
\
template< class Tag, class SymmetricType > \
BOOST_DEDUCED_TYPENAME result_of::NAME<Tag,SymmetricType>::type \
NAME( SymmetricType & s ) \
{ \
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: \
member_with_tag \
< \
Tag,SymmetricType \
\
>::type member_at_tag; \
\
return detail::NAME(member_at_tag(),s); \
}
/*===========================================================================*/
#endif // BOOST_BIMAP_RELATION_ACCESS_BUILDER_HPP

View File

@@ -0,0 +1,103 @@
// 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/detail/metadata_access_builder.hpp
/// \brief Define macros to help building metafunctions
#ifndef BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCESS_BUILDER_HPP
#define BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCESS_BUILDER_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/relation/support/is_tag_of_member_at.hpp>
#include <boost/bimap/detail/debug/static_error.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/cat.hpp>
/******************************************************************************
BIMAP SYMMETRIC METADATA ACCESS INTERFACE
*******************************************************************************
template< class Tag, class SymmetricType >
struct NAME
{
typedef -unspecified- type;
};
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_METADATA_ACCESS_BUILDER( \
\
NAME, \
METADATA_BY_LEFT, \
METADATA_BY_RIGHT \
) \
\
template \
< \
class Tag, \
class SymmetricType, \
class Enable = void \
> \
struct NAME \
{ \
BOOST_BIMAP_STATIC_ERROR( \
BOOST_PP_CAT(NAME,_FAILURE), \
(SymmetricType,Tag) \
); \
}; \
\
template< class Tag, class SymmetricType > \
struct NAME \
< \
Tag, SymmetricType, \
BOOST_DEDUCED_TYPENAME enable_if \
< \
::boost::bimaps::relation::support::is_tag_of_member_at_left \
< \
Tag, \
SymmetricType \
> \
\
>::type \
> \
{ \
typedef BOOST_DEDUCED_TYPENAME SymmetricType::METADATA_BY_LEFT type; \
}; \
\
template< class Tag, class SymmetricType > \
struct NAME \
< \
Tag, SymmetricType, \
BOOST_DEDUCED_TYPENAME enable_if \
< \
::boost::bimaps::relation::support::is_tag_of_member_at_right \
< \
Tag, \
SymmetricType \
> \
\
>::type \
> \
{ \
typedef BOOST_DEDUCED_TYPENAME SymmetricType::METADATA_BY_RIGHT type; \
};
/*===========================================================================*/
#endif // BOOST_BIMAP_RELATION_DETAIL_METADATA_ACCES_BUILDER_HPP

View File

@@ -0,0 +1,83 @@
// 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/detail/mutant.hpp
/// \brief Mutate functions to extract views of mutant classes.
#ifndef BOOST_BIMAP_RELATION_DETAIL_MUTANT_HPP
#define BOOST_BIMAP_RELATION_DETAIL_MUTANT_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/debug/static_error.hpp>
#include <boost/mpl/contains.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/utility.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/not.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost {
namespace bimaps {
namespace relation {
/// \brief Relation details, mutant idiom and symmetrical metafunctions builders.
namespace detail {
//@{
/// \brief Converts a mutant class to a view with zero overhead.
/**
This function is a safe wrapper around reinterpret_cast. It checks at
compile time that the desired view is supported by the mutant class.
See also mutant, can_mutate_in.
\ingroup mutant_group
**/
template< class View, class Type >
BOOST_DEDUCED_TYPENAME enable_if< mpl::not_< is_const< Type > >,
View&
>::type mutate( Type & m )
{
BOOST_MPL_ASSERT((
::boost::mpl::contains<BOOST_DEDUCED_TYPENAME Type::mutant_views,View>
));
return *reinterpret_cast< View* >(boost::addressof(m));
}
template< class View, class Type >
BOOST_DEDUCED_TYPENAME enable_if< is_const< Type >,
const View&
>::type mutate( Type & m )
{
BOOST_MPL_ASSERT((
::boost::mpl::contains<BOOST_DEDUCED_TYPENAME Type::mutant_views,View>
));
return *reinterpret_cast< const View* >(boost::addressof(m));
}
//@}
} // namespace detail
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_RELATION_DETAIL_MUTANT_HPP

View File

@@ -0,0 +1,105 @@
// 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/detail/static_access_builder.hpp
/// \brief Define macros to help building metafunctions
#ifndef BOOST_BIMAP_RELATION_DETAIL_STATIC_ACCESS_BUILDER_HPP
#define BOOST_BIMAP_RELATION_DETAIL_STATIC_ACCESS_BUILDER_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/relation/support/is_tag_of_member_at.hpp>
#include <boost/bimap/detail/debug/static_error.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/cat.hpp>
/******************************************************************************
BIMAP SYMMETRIC STATIC ACCESS INTERFACE
*******************************************************************************
template< class Tag, class SYMETRIC_TYPE >
struct NAME
{
-UNDEFINED BODY-;
};
******************************************************************************/
/*===========================================================================*/
#define BOOST_BIMAP_SYMMETRIC_STATIC_ACCESS_BUILDER( \
\
NAME, \
SYMMETRIC_TYPE, \
LEFT_BODY, \
RIGHT_BODY \
) \
\
template \
< \
class Tag, \
class SYMMETRIC_TYPE, \
class Enable = void \
> \
struct NAME \
{ \
BOOST_BIMAP_STATIC_ERROR( \
BOOST_PP_CAT(NAME,_FAILURE), \
(SYMMETRIC_TYPE,Tag) \
); \
}; \
\
template< class Tag, class SYMMETRIC_TYPE > \
struct NAME \
< \
Tag, SYMMETRIC_TYPE, \
BOOST_DEDUCED_TYPENAME enable_if \
< \
::boost::bimaps::relation::support::is_tag_of_member_at_left \
< \
Tag, \
SYMMETRIC_TYPE \
> \
\
>::type \
> \
{ \
LEFT_BODY; \
}; \
\
template< class Tag, class SYMMETRIC_TYPE > \
struct NAME \
< \
Tag, SYMMETRIC_TYPE, \
BOOST_DEDUCED_TYPENAME enable_if \
< \
::boost::bimaps::relation::support::is_tag_of_member_at_right \
< \
Tag, \
SYMMETRIC_TYPE \
> \
\
>::type \
> \
{ \
RIGHT_BODY; \
};
/*===========================================================================*/
#endif // BOOST_BIMAP_RELATION_DETAIL_STATIC_ACCES_BUILDER_HPP

View File

@@ -0,0 +1,102 @@
// 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/detail/to_mutable_relation_functor.hpp
/// \brief functors to convert types to mutable relations
#ifndef BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP
#define BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_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/mutant.hpp>
#include <boost/bimap/relation/mutant_relation.hpp>
namespace boost {
namespace bimaps {
namespace relation {
namespace detail {
/// \brief Functor used in map views
template< class Tag, class Relation >
struct pair_to_relation_functor
{
const Relation
operator()(const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
pair_type_by<Tag,Relation>::type & p) const
{
return Relation(p);
}
};
template< class Tag, class TA, class TB, class Info >
struct pair_to_relation_functor<
Tag,::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> >
{
typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
Relation &
operator()( BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
pair_type_by<Tag,Relation>::type & p ) const
{
return ::boost::bimaps::relation::detail::mutate<Relation>(p);
}
const Relation &
operator()( const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
pair_type_by<Tag,Relation>::type & p) const
{
return ::boost::bimaps::relation::detail::mutate<Relation>(p);
}
};
/// \brief Used in set views
template< class Relation >
struct get_mutable_relation_functor
{
const Relation
operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
{
return Relation(r);
}
};
template< class TA, class TB, class Info >
struct get_mutable_relation_functor< ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> >
{
typedef ::boost::bimaps::relation::mutant_relation<TA,TB,Info,true> Relation;
Relation &
operator()( BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
{
return ::boost::bimaps::relation::detail::mutate<Relation>(r);
}
const Relation &
operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const
{
return ::boost::bimaps::relation::detail::mutate<Relation>(r);
}
};
} // namespace detail
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_RELATION_DETAIL_TO_MUTABLE_RELATION_FUNCTOR_HPP

View File

@@ -0,0 +1,72 @@
// 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/member_at.hpp
/// \brief Defines the tags for the member_at::side idiom
#ifndef BOOST_BIMAP_RELATION_MEMBER_AT_HPP
#define BOOST_BIMAP_RELATION_MEMBER_AT_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
namespace boost {
namespace bimaps {
namespace relation {
/// \brief member_at::side idiom to access relation values and types using metaprogramming.
/**
This tags are used to specify which member you want to acces when using a metafunction over
a symmetrical type. The idea is to be able to write code like:
\code
result_of::get<member_at::left,relation>::type data = get<member_at::left>(rel);
\endcode
The relation class supports this idiom even when the elements are tagged. This is useful
because a user can decide to start tagging in any moment of the development.
See also member_with_tag, is_tag_of_member_at_left, is_tag_of_member_at_right, get
value_type_of, pair_by, pair_type_by.
\ingroup relation_group
**/
namespace member_at {
/// \brief Member at left tag
/**
See also member_at, rigth.
**/
struct left {};
/// \brief Member at right tag
/**
See also member_at, left.
**/
struct right {};
/// \brief Member info tag
/**
See also member_at, left, right.
**/
struct info {};
}
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_RELATION_MEMBER_AT_HPP

View File

@@ -0,0 +1,430 @@
// 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/mutant_relation.hpp
/// \brief Defines the mutant_relation class
#ifndef BOOST_BIMAP_RELATION_MUTANT_RELATION_HPP
#define BOOST_BIMAP_RELATION_MUTANT_RELATION_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/operators.hpp>
#include <boost/call_traits.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/functional/hash/hash.hpp>
#include <boost/mpl/aux_/na.hpp>
// Boost.Bimap
#include <boost/bimap/tags/tagged.hpp>
#include <boost/bimap/tags/support/default_tagged.hpp>
#include <boost/bimap/tags/support/tag_of.hpp>
#include <boost/bimap/tags/support/value_type_of.hpp>
#include <boost/bimap/relation/member_at.hpp>
#include <boost/bimap/relation/detail/mutant.hpp>
#include <boost/bimap/relation/structured_pair.hpp>
#include <boost/bimap/relation/symmetrical_base.hpp>
#include <boost/bimap/relation/support/get.hpp>
namespace boost {
namespace bimaps {
namespace relation {
namespace detail {
// This class is included so structured_pair and mutant_relation share
// exactly the same class layout
template< class LeftType, class RightType, bool force_mutable >
class relation_storage :
public symmetrical_base<LeftType,RightType,force_mutable>
{
typedef symmetrical_base<LeftType,RightType,force_mutable> base_;
typedef relation_storage storage_;
public:
typedef relation_storage<LeftType,RightType,false> non_mutable_storage;
typedef ::boost::mpl::vector2
<
relation_storage< LeftType, RightType, true >,
relation_storage< LeftType, RightType, false >
> mutant_views;
//@{
/// data
BOOST_DEDUCED_TYPENAME base_::left_value_type left;
BOOST_DEDUCED_TYPENAME base_::right_value_type right;
//@}
relation_storage() {}
relation_storage(BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::left_value_type
>::param_type l,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::right_value_type
>::param_type r)
: left(l), right(r) {}
BOOST_DEDUCED_TYPENAME base_:: left_value_type & get_left() { return left; }
const BOOST_DEDUCED_TYPENAME base_:: left_value_type & get_left()const { return left; }
BOOST_DEDUCED_TYPENAME base_::right_value_type & get_right() { return right; }
const BOOST_DEDUCED_TYPENAME base_::right_value_type & get_right()const { return right; }
};
template< class TA, class TB, class Info, bool force_mutable >
class relation_info_hook : public
::boost::bimaps::relation::detail::relation_storage<TA,TB,force_mutable>
{
typedef ::boost::bimaps::relation::detail::
relation_storage<TA,TB,force_mutable> base_;
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::tags::support::
default_tagged<Info,member_at::info>::type tagged_info_type;
public:
typedef BOOST_DEDUCED_TYPENAME tagged_info_type::value_type info_type;
typedef BOOST_DEDUCED_TYPENAME tagged_info_type::tag info_tag;
info_type info;
protected:
relation_info_hook() {}
relation_info_hook( BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::left_value_type
>::param_type l,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::right_value_type
>::param_type r,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
info_type
>::param_type i = info_type() )
: base_(l,r), info(i) {}
template< class Relation >
relation_info_hook( const Relation & rel ) :
base_(rel.left,rel.right),
info(rel.info) {}
template< class Relation >
void change_to( const Relation & rel )
{
base_::left = rel.left ;
base_::right = rel.right;
info = rel.info ;
}
#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION
template< class Archive >
void serialize(Archive & ar, const unsigned int version)
{
ar & ::boost::serialization::make_nvp("left" , base_::left );
ar & ::boost::serialization::make_nvp("right", base_::right);
ar & ::boost::serialization::make_nvp("info" , info );
}
#endif // BOOST_BIMAP_DISABLE_SERIALIZATION
};
template< class TA, class TB, bool force_mutable>
class relation_info_hook<TA,TB,::boost::mpl::na,force_mutable> :
public ::boost::bimaps::relation::detail::relation_storage<TA,TB,force_mutable>
{
typedef ::boost::bimaps::relation::detail::
relation_storage<TA,TB,force_mutable> base_;
public:
typedef ::boost::mpl::na info_type;
typedef member_at::info info_tag;
protected:
relation_info_hook() {}
relation_info_hook( BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::left_value_type
>::param_type l,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::right_value_type
>::param_type r)
: base_(l,r) {}
template< class Relation >
relation_info_hook( const Relation & rel ) :
base_(rel.left,rel.right) {}
template< class Relation >
void change_to( const Relation & rel )
{
base_::left = rel.left ;
base_::right = rel.right;
}
#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION
template< class Archive >
void serialize(Archive & ar, const unsigned int version)
{
ar & ::boost::serialization::make_nvp("left" , base_::left );
ar & ::boost::serialization::make_nvp("right", base_::right);
}
#endif // BOOST_BIMAP_DISABLE_SERIALIZATION
};
} // namespace detail
/// \brief Abstraction of a related pair of values, that extends the std::pair class.
/**
The mutant_relation is a mutant class. A mutant class can mutate
with zero overhead in other classes that are called views.
Each view has to be StorageCompatible with the base class
of the mutant. Note that all the views have the following
storage structure:
\verbatim
__________
| |
| TA |
|__________|
| |
| TB |
|__________|
\endverbatim
See also select_relation, standard_relation.
\ingroup relation_group
**/
template< class TA, class TB, class Info = ::boost::mpl::na, bool force_mutable = false >
class mutant_relation : public
::boost::bimaps::relation::detail::
relation_info_hook<TA,TB,Info,force_mutable>
{
typedef ::boost::bimaps::relation::detail::
relation_info_hook<TA,TB,Info,force_mutable> base_;
public:
// We have to know the type of the base where the types are
// defined because Boost.MultiIndex requires it.
typedef ::boost::bimaps::relation::detail::
relation_storage<TA,TB,force_mutable> storage_base;
/// Above view, non mutable view of the relation
typedef mutant_relation<TA,TB,Info,false> above_view;
//@{
/// A signature compatible std::pair that is a view of the relation.
typedef structured_pair< TA, TB, Info, normal_layout > left_pair;
typedef structured_pair< TB, TA, Info, mirror_layout > right_pair;
//@}
typedef ::boost::mpl::vector4
<
left_pair,
right_pair,
mutant_relation< TA, TB, Info, true >,
mutant_relation< TA, TB, Info, false >
> mutant_views;
mutant_relation() {}
mutant_relation(BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_:: left_value_type
>::param_type l,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::right_value_type
>::param_type r) :
base_(l,r) {}
mutant_relation(BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_:: left_value_type
>::param_type l,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::right_value_type
>::param_type r,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::info_type
>::param_type i) :
base_(l,r,i) {}
mutant_relation(const mutant_relation<TA,TB,Info,false> & rel) :
base_(rel) {}
mutant_relation(const mutant_relation<TA,TB,Info,true> & rel) :
base_(rel) {}
// Operators
template< bool FM >
mutant_relation& operator=(const mutant_relation<TA,TB,Info,FM> & rel)
{
base_::change_to(rel);
return *this;
}
// The following functions are redundant if you only consider this class.
// They are included to make easier the construction of the get and the
// pair_by metafunction. Remember that not all compiler supports the mutant
// idiom.
left_pair & get_left_pair()
{
return ::boost::bimaps::relation::detail::mutate<left_pair>(*this);
}
const left_pair & get_left_pair() const
{
return ::boost::bimaps::relation::detail::mutate<left_pair>(*this);
}
right_pair & get_right_pair()
{
return ::boost::bimaps::relation::detail::mutate<right_pair>(*this);
}
const right_pair & get_right_pair() const
{
return ::boost::bimaps::relation::detail::mutate<right_pair>(*this);
}
above_view & get_view()
{
return ::boost::bimaps::relation::detail::mutate<above_view>(*this);
}
const above_view & get_view() const
{
return ::boost::bimaps::relation::detail::mutate<above_view>(*this);
}
template< class Tag >
const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
result_of::get<Tag,const mutant_relation>::type
get(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag)) const
{
return ::boost::bimaps::relation::support::get<Tag>(*this);
}
template< class Tag >
BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
result_of::get<Tag,mutant_relation>::type
get(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag))
{
return ::boost::bimaps::relation::support::get<Tag>(*this);
}
#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION
private:
friend class ::boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
base_::serialize(ar,version);
}
#endif // BOOST_BIMAP_DISABLE_SERIALIZATION
};
// hash value
template< class FirstType, class SecondType, bool FM >
std::size_t hash_value(const detail::relation_storage<FirstType,SecondType,FM> & r)
{
std::size_t seed = 0;
::boost::hash_combine(seed, r. left );
::boost::hash_combine(seed, r.right );
return seed;
}
// mutant_relation - mutant_relation
template< class FirstType, class SecondType, bool FM1, bool FM2 >
bool operator==(const detail::relation_storage<FirstType,SecondType,FM1> & a,
const detail::relation_storage<FirstType,SecondType,FM2> & b)
{
return ( ( a.left == b.left ) &&
( a.right == b.right ) );
}
template< class FirstType, class SecondType, bool FM1, bool FM2 >
bool operator!=(const detail::relation_storage<FirstType,SecondType,FM1> & a,
const detail::relation_storage<FirstType,SecondType,FM2> & b)
{
return ! ( a == b );
}
template< class FirstType, class SecondType, bool FM1, bool FM2 >
bool operator<(const detail::relation_storage<FirstType,SecondType,FM1> & a,
const detail::relation_storage<FirstType,SecondType,FM2> & b)
{
return ( ( a.left < b.left ) ||
(( a.left == b.left ) && ( a.right < b.right )));
}
template< class FirstType, class SecondType, bool FM1, bool FM2 >
bool operator<=(const detail::relation_storage<FirstType,SecondType,FM1> & a,
const detail::relation_storage<FirstType,SecondType,FM2> & b)
{
return ( ( a.left < b.left ) ||
(( a.left == b.left ) && ( a.right <= b.right )));
}
template< class FirstType, class SecondType, bool FM1, bool FM2 >
bool operator>(const detail::relation_storage<FirstType,SecondType,FM1> & a,
const detail::relation_storage<FirstType,SecondType,FM2> & b)
{
return ( ( a.left > b.left ) ||
(( a.left == b.left ) && ( a.right > b.right )));
}
template< class FirstType, class SecondType, bool FM1, bool FM2 >
bool operator>=(const detail::relation_storage<FirstType,SecondType,FM1> & a,
const detail::relation_storage<FirstType,SecondType,FM2> & b)
{
return ( ( a.left > b.left ) ||
(( a.left == b.left ) && ( a.right >= b.right )));
}
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_RELATION_MUTANT_RELATION_HPP

View File

@@ -0,0 +1,72 @@
// 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/pair_layout.hpp
/// \brief Tags for pair layouts
#ifndef BOOST_BIMAP_RELATION_PAIR_LAYOUT_HPP
#define BOOST_BIMAP_RELATION_PAIR_LAYOUT_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
namespace boost {
namespace bimaps {
namespace relation {
//@{
/// \brief Tag for normal layout. ( A,B -> A,B )
struct normal_layout {};
/// \brief Tag for mirror layout. ( A,B -> B,A )
struct mirror_layout {};
//@}
/** \struct boost::bimaps::relation::inverse_layout
\brief Metafunction to obtain the inverse of a layout.
\code
template< class Layout >
struct inverse_layout
{
typedef {InverseLayout} type;
};
\endcode
See also normal_layout, mirror_layout.
**/
#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
template< class Layout >
struct inverse_layout
{
typedef normal_layout type;
};
template<>
struct inverse_layout< normal_layout >
{
typedef mirror_layout type;
};
#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_RELATION_DETAIL_PAIR_LAYOUT_HPP

View File

@@ -0,0 +1,508 @@
// 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/structured_pair.hpp
/// \brief Defines the structured_pair class.
#ifndef BOOST_BIMAP_RELATION_STRUCTURED_PAIR_HPP
#define BOOST_BIMAP_RELATION_STRUCTURED_PAIR_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <utility>
#include <boost/type_traits/remove_const.hpp>
#include <boost/mpl/aux_/na.hpp>
#include <boost/call_traits.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/bimap/detail/debug/static_error.hpp>
#include <boost/bimap/relation/pair_layout.hpp>
#include <boost/bimap/relation/symmetrical_base.hpp>
#include <boost/bimap/relation/support/get.hpp>
#include <boost/bimap/tags/support/value_type_of.hpp>
namespace boost {
namespace bimaps {
namespace relation {
namespace detail {
/// \brief Storage definition of the left view of a mutant relation.
/**
See also storage_finder, mirror_storage.
**/
template< class FirstType, class SecondType >
class normal_storage :
public symmetrical_base<FirstType,SecondType>
{
typedef symmetrical_base<FirstType,SecondType> base_;
public:
typedef normal_storage storage_;
typedef BOOST_DEDUCED_TYPENAME base_::left_value_type first_type;
typedef BOOST_DEDUCED_TYPENAME base_::right_value_type second_type;
first_type first;
second_type second;
normal_storage() {}
normal_storage(BOOST_DEDUCED_TYPENAME ::boost::call_traits<
first_type >::param_type f,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
second_type>::param_type s)
: first(f), second(s) {}
BOOST_DEDUCED_TYPENAME base_:: left_value_type & get_left() { return first; }
const BOOST_DEDUCED_TYPENAME base_:: left_value_type & get_left()const { return first; }
BOOST_DEDUCED_TYPENAME base_::right_value_type & get_right() { return second; }
const BOOST_DEDUCED_TYPENAME base_::right_value_type & get_right()const { return second; }
};
/// \brief Storage definition of the right view of a mutant relation.
/**
See also storage_finder, normal_storage.
**/
template< class FirstType, class SecondType >
class mirror_storage :
public symmetrical_base<SecondType,FirstType>
{
typedef symmetrical_base<SecondType,FirstType> base_;
public:
typedef mirror_storage storage_;
typedef BOOST_DEDUCED_TYPENAME base_::left_value_type second_type;
typedef BOOST_DEDUCED_TYPENAME base_::right_value_type first_type;
second_type second;
first_type first;
mirror_storage() {}
mirror_storage(BOOST_DEDUCED_TYPENAME ::boost::call_traits<first_type >::param_type f,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<second_type >::param_type s)
: second(s), first(f) {}
BOOST_DEDUCED_TYPENAME base_:: left_value_type & get_left() { return second; }
const BOOST_DEDUCED_TYPENAME base_:: left_value_type & get_left()const { return second; }
BOOST_DEDUCED_TYPENAME base_::right_value_type & get_right() { return first; }
const BOOST_DEDUCED_TYPENAME base_::right_value_type & get_right()const { return first; }
};
/** \struct boost::bimaps::relation::storage_finder
\brief Obtain the a storage with the correct layout.
\code
template< class FirstType, class SecondType, class Layout >
struct storage_finder
{
typedef {normal/mirror}_storage<FirstType,SecondType> type;
};
\endcode
See also normal_storage, mirror_storage.
**/
#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
template
<
class FirstType,
class SecondType,
class Layout
>
struct storage_finder
{
typedef normal_storage<FirstType,SecondType> type;
};
template
<
class FirstType,
class SecondType
>
struct storage_finder<FirstType,SecondType,mirror_layout>
{
typedef mirror_storage<FirstType,SecondType> type;
};
#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
template< class TA, class TB, class Info, class Layout >
class pair_info_hook :
public ::boost::bimaps::relation::detail::storage_finder<TA,TB,Layout>::type
{
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::detail::storage_finder<TA,TB,Layout>::type base_;
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::tags::support::
default_tagged<Info,member_at::info>::type tagged_info_type;
public:
typedef BOOST_DEDUCED_TYPENAME tagged_info_type::value_type info_type;
typedef BOOST_DEDUCED_TYPENAME tagged_info_type::tag info_tag;
info_type info;
protected:
pair_info_hook() {}
pair_info_hook( BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::first_type
>::param_type f,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::second_type
>::param_type s,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
info_type
>::param_type i = info_type() )
: base_(f,s), info(i) {}
template< class Pair >
pair_info_hook( const Pair & p) :
base_(p.first,p.second),
info(p.info) {}
template< class Pair >
void change_to( const Pair & p )
{
base_::first = p.first ;
base_::second = p.second;
info = p.info ;
}
void clear_info()
{
info = info_type();
};
};
template< class TA, class TB, class Layout>
class pair_info_hook<TA,TB,::boost::mpl::na,Layout> :
public ::boost::bimaps::relation::detail::storage_finder<TA,TB,Layout>::type
{
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::detail::storage_finder<TA,TB,Layout>::type base_;
public:
typedef ::boost::mpl::na info_type;
typedef member_at::info info_tag;
protected:
pair_info_hook() {}
pair_info_hook( BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::first_type
>::param_type f,
BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::second_type
>::param_type s)
: base_(f,s) {}
template< class Pair >
pair_info_hook( const Pair & p ) :
base_(p.first,p.second) {}
template< class Pair >
void change_to( const Pair & p )
{
base_::first = p.first ;
base_::second = p.second;
}
void clear_info() {};
};
} // namespace detail
template< class TA, class TB, class Info, bool FM >
class mutant_relation;
/// \brief A std::pair signature compatible class that allows you to control
/// the internal structure of the data.
/**
This class allows you to specify the order in wich the two data types will be
in the layout of the class.
**/
template< class FirstType, class SecondType, class Info, class Layout = normal_layout >
class structured_pair :
public ::boost::bimaps::relation::detail::pair_info_hook
<
FirstType, SecondType,
Info,
Layout
>
{
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::detail::pair_info_hook
<
FirstType, SecondType,
Info,
Layout
> base_;
public:
typedef ::boost::mpl::vector3<
structured_pair< FirstType, SecondType, Info, normal_layout >,
structured_pair< FirstType, SecondType, Info, mirror_layout >,
BOOST_DEDUCED_TYPENAME ::boost::mpl::if_<
BOOST_DEDUCED_TYPENAME ::boost::is_same<Layout, normal_layout>::type,
mutant_relation< FirstType, SecondType, Info, true >,
mutant_relation< SecondType, FirstType, Info, true >
>::type
> mutant_views;
structured_pair() {}
structured_pair(BOOST_DEDUCED_TYPENAME boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::first_type >::param_type f,
BOOST_DEDUCED_TYPENAME boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::second_type >::param_type s)
: base_(f,s) {}
structured_pair(BOOST_DEDUCED_TYPENAME boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::first_type >::param_type f,
BOOST_DEDUCED_TYPENAME boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::second_type >::param_type s,
BOOST_DEDUCED_TYPENAME boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::info_type >::param_type i)
: base_(f,s,i) {}
template< class OtherLayout >
structured_pair(
const structured_pair<FirstType,SecondType,Info,OtherLayout> & p)
: base_(p) {}
template< class OtherLayout >
structured_pair& operator=(
const structured_pair<FirstType,SecondType,OtherLayout> & p)
{
base_::change_to(p);
return *this;
}
template< class First, class Second >
structured_pair(const std::pair<First,Second> & p) :
base_(p.first,p.second)
{}
template< class First, class Second >
structured_pair& operator=(const std::pair<First,Second> & p)
{
base_::first = p.first;
base_::second = p.second;
base_::clear_info();
return *this;
}
template< class Tag >
const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
result_of::get<Tag,const structured_pair>::type
get(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag)) const
{
return ::boost::bimaps::relation::support::get<Tag>(*this);
}
template< class Tag >
BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
result_of::get<Tag,structured_pair>::type
get(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag))
{
return ::boost::bimaps::relation::support::get<Tag>(*this);
}
};
// structured_pair - structured_pair
template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >
bool operator==(const structured_pair<FirstType,SecondType,Info,Layout1> & a,
const structured_pair<FirstType,SecondType,Info,Layout2> & b)
{
return ( ( a.first == b.first ) &&
( a.second == b.second ) );
}
template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >
bool operator!=(const structured_pair<FirstType,SecondType,Info,Layout1> & a,
const structured_pair<FirstType,SecondType,Info,Layout2> & b)
{
return ! ( a == b );
}
template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >
bool operator<(const structured_pair<FirstType,SecondType,Info,Layout1> & a,
const structured_pair<FirstType,SecondType,Info,Layout2> & b)
{
return ( ( a.first < b.first ) ||
(( a.first == b.first ) && ( a.second < b.second )));
}
template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >
bool operator<=(const structured_pair<FirstType,SecondType,Info,Layout1> & a,
const structured_pair<FirstType,SecondType,Info,Layout2> & b)
{
return ( ( a.first < b.first ) ||
(( a.first == b.first ) && ( a.second <= b.second )));
}
template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >
bool operator>(const structured_pair<FirstType,SecondType,Info,Layout1> & a,
const structured_pair<FirstType,SecondType,Info,Layout2> & b)
{
return ( ( a.first > b.first ) ||
(( a.first == b.first ) && ( a.second > b.second )));
}
template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >
bool operator>=(const structured_pair<FirstType,SecondType,Info,Layout1> & a,
const structured_pair<FirstType,SecondType,Info,Layout2> & b)
{
return ( ( a.first > b.first ) ||
(( a.first == b.first ) && ( a.second >= b.second )));
}
// structured_pair - std::pair
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator==(const structured_pair<FirstType,SecondType,Info,Layout> & a,
const std::pair<F,S> & b)
{
return ( ( a.first == b.first ) &&
( a.second == b.second ) );
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator!=(const structured_pair<FirstType,SecondType,Info,Layout> & a,
const std::pair<F,S> & b)
{
return ! ( a == b );
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator<(const structured_pair<FirstType,SecondType,Info,Layout> & a,
const std::pair<F,S> & b)
{
return ( ( a.first < b.first ) ||
(( a.first == b.first ) && ( a.second < b.second )));
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator<=(const structured_pair<FirstType,SecondType,Info,Layout> & a,
const std::pair<F,S> & b)
{
return ( ( a.first < b.first ) ||
(( a.first == b.first ) && ( a.second <= b.second )));
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator>(const structured_pair<FirstType,SecondType,Info,Layout> & a,
const std::pair<F,S> & b)
{
return ( ( a.first > b.first ) ||
(( a.first == b.first ) && ( a.second > b.second )));
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator>=(const structured_pair<FirstType,SecondType,Info,Layout> & a,
const std::pair<F,S> & b)
{
return ( ( a.first > b.first ) ||
(( a.first == b.first ) && ( a.second >= b.second )));
}
// std::pair - sturctured_pair
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator==(const std::pair<F,S> & a,
const structured_pair<FirstType,SecondType,Info,Layout> & b)
{
return ( ( a.first == b.first ) &&
( a.second == b.second ) );
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator!=(const std::pair<F,S> & a,
const structured_pair<FirstType,SecondType,Info,Layout> & b)
{
return ! ( a == b );
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator<(const std::pair<F,S> & a,
const structured_pair<FirstType,SecondType,Info,Layout> & b)
{
return ( ( a.first < b.first ) ||
(( a.first == b.first ) && ( a.second < b.second )));
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator<=(const std::pair<F,S> & a,
const structured_pair<FirstType,SecondType,Info,Layout> & b)
{
return ( ( a.first < b.first ) ||
(( a.first == b.first ) && ( a.second <= b.second )));
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator>(const std::pair<F,S> & a,
const structured_pair<FirstType,SecondType,Info,Layout> & b)
{
return ( ( a.first > b.first ) ||
(( a.first == b.first ) && ( a.second > b.second )));
}
template< class FirstType, class SecondType, class Info, class Layout, class F, class S >
bool operator>=(const std::pair<F,S> & a,
const structured_pair<FirstType,SecondType,Info,Layout> & b)
{
return ( ( a.first > b.first ) ||
(( a.first == b.first ) && ( a.second >= b.second )));
}
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_RELATION_STRUCTURED_PAIR_HPP

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,97 @@
// 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/symmetrical_base.hpp
/// \brief Base class for symmetrical types
#ifndef BOOST_BIMAP_RELATION_SYMMETRICAL_BASE_HPP
#define BOOST_BIMAP_RELATION_SYMMETRICAL_BASE_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/remove_const.hpp>
// Boost.Bimap
#include <boost/bimap/tags/tagged.hpp>
#include <boost/bimap/tags/support/default_tagged.hpp>
#include <boost/bimap/relation/member_at.hpp>
namespace boost {
namespace bimaps {
namespace relation {
/// \brief Base of symetrical tagged types.
/**
**/
template< class TA, class TB, bool force_mutable = false >
class symmetrical_base
{
public:
typedef BOOST_DEDUCED_TYPENAME tags::support::default_tagged
<
TA,
member_at::left
>::type tagged_left_type;
typedef BOOST_DEDUCED_TYPENAME tags::support::default_tagged
<
TB,
member_at::right
>::type tagged_right_type;
public:
//@{
/// The type stored in the relation
typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< force_mutable,
BOOST_DEDUCED_TYPENAME ::boost::remove_const<
BOOST_DEDUCED_TYPENAME tagged_left_type::value_type >::type,
BOOST_DEDUCED_TYPENAME tagged_left_type::value_type
>::type left_value_type;
typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< force_mutable,
BOOST_DEDUCED_TYPENAME ::boost::remove_const<
BOOST_DEDUCED_TYPENAME tagged_right_type::value_type >::type,
BOOST_DEDUCED_TYPENAME tagged_right_type::value_type
>::type right_value_type;
//@}
//@{
/// The tag of the member. By default it is \c member_at::{side}
typedef BOOST_DEDUCED_TYPENAME tagged_left_type ::tag left_tag;
typedef BOOST_DEDUCED_TYPENAME tagged_right_type::tag right_tag;
//@}
};
} // namespace relation
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_RELATION_SYMMETRICAL_BASE_HPP