Update of /cvsroot/boost/boost/boost/bimap
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24149/boost/bimap
Added Files:
bimap.hpp list_of.hpp multiset_of.hpp set_of.hpp
unconstrained_set_of.hpp unordered_multiset_of.hpp
unordered_set_of.hpp vector_of.hpp
Log Message:
first bimap commit
--- NEW FILE: bimap.hpp ---
// 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 bimap.hpp
/// \brief Includes the basic bimap container
/** \mainpage notitle
\n
\image html
http://matias.capeletto.googlepages.com/boost.bimap.reference.logo.png
\section Introduction
This is the complete reference of Boost.Bimap.
After getting a good understanding of the library from a user perspective
the next step will be:
- Understand the tagged idiom. (boost::bimaps::tags)
- Understand the internals of the relation class (boost::bimaps::relation)
- Read the container_adaptor toolbox docs (boost::bimaps::container_adaptor)
- Understand the internals of the bimap class. (boost::bimaps,
boost::bimaps::views
and boost::bimaps::detail)
**/
/** \defgroup mutant_group mutant idiom
\brief A safe wrapper around reinterpret_cast
**/
/** \defgroup relation_group relation
\brief The relation
**/
/** \defgroup tags_group tagged idiom
\brief The tagged idiom
**/
#ifndef BOOST_BIMAP_BIMAP_HPP
#define BOOST_BIMAP_BIMAP_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/user_interface_config.hpp>
#include <boost/mpl/aux_/na.hpp>
#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION
#include <boost/serialization/nvp.hpp>
#endif // BOOST_BIMAP_DISABLE_SERIALIZATION
// Boost.Bimap
#include <boost/bimap/detail/bimap_core.hpp>
#include <boost/bimap/detail/modifier_adaptor.hpp>
#include <boost/bimap/relation/support/data_extractor.hpp>
#include <boost/bimap/relation/support/member_with_tag.hpp>
#include <boost/bimap/support/map_type_by.hpp>
#include <boost/bimap/support/map_by.hpp>
#include <boost/bimap/support/iterator_type_by.hpp>
/// \brief The namespace where all the boost libraries lives.
namespace boost {
/// \brief Boost.Bimap library namespace
/**
All the entities in the library are defined in this namespace.
**/
namespace bimaps {
/// \brief The bimap class is the entry point to the library.
/**
This class manages the instantiation of the desired bimap type.
As there are several types of bidirectional maps that can be
created using it, the main job of it is to find the desired
type. This is done using metaprogramming to obtain the relation
type that will be stored, the map_view type of each side and
the set_view type of the general relationship. The instantiation
is kept simple using an extended standard set theory, where a
bidirectional map type is defined by the set types it relates.
For example, a bidirectional map that has multimap semantics
viewed from both sides is defined by specifying that the two
keys sets are of \c multiset_of<Key> type.
This allows the bimap class to support seamingless N-N, 1-N,
ordered/unordered and even vector-list types of mapping.
The three last parameters are used to specify the set type of
the relation, an inplace hooked data class and the allocator
type. As a help to the bimap user, these parameters support
default types but use a special idiom that allow them to be
specified without interleaving the usual use_default keyword.
The possible bimap instantiation are enumerated here:
\c {Side}KeyType can be directly a type, this is default to
\c set_of<{Side}KeyType>, or can be a \c {SetType}_of<Type>
specification. Additionally this two parameters can be tagged
to specify others tags instead of the usual \c member_at::{Side}
ones.
\code bimap<LeftKeyType,RightKeyType> \endcode
- \b set_of_relation_type: based on the left key type
- \b hook_data: no additional data
- \b allocator: default allocator
\code bimap<LeftKeyType,RightKeyType> \endcode
- \b set_of_relation_type: based on the left key type
- \b hook_data: no additional data
- \b allocator: \c Allocator
\code bimap<LeftKeyType,RightKeyType,SetOfRelationType> \endcode
- \b set_of_relation_type: \c SetOfRelationType
- \b hook_data: no additional data
- \b allocator: default allocator
\code bimap<LeftKeyType,RightKeyType,SetOfRelationType,Allocator> \endcode
- \b set_of_relation_type: \c SetOfRelationType
- \b hook_data: no additional data
- \b allocator: \c Allocator
\code bimap<LeftKeyType,RightKeyType,DataToHook> \endcode
- \b set_of_relation_type: based on the left key type
- \b hook_data: \c DataToHook
- \b allocator: default allocator
\code bimap<LeftKeyType,RightKeyType,DataToHook,Allocator> \endcode
- \b set_type_of_relation: based on the left key type
- \b hook_data: \c DataToHook
- \b allocator: \c Allocator
\code bimap<LeftKeyType,RightKeyType,SetOfRelationType,DataToHook> \endcode
- \b set_of_relation_type: \c SetOfRelationType
- \b hook_data: \c DataToHook
- \b allocator: default allocator
\code bimap<LeftKeyType,RightKeyType,SetOfRelationType,DataToHook,Allocator>
\endcode
- \b set_of_relation_type: \c SetOfRelationType
- \b hook_data: \c DataToHook
- \b allocator: \c Allocator
**/
template
<
class KeyTypeA, class KeyTypeB,
class AP1 = ::boost::mpl::na,
class AP2 = ::boost::mpl::na,
class AP3 = ::boost::mpl::na
>
class bimap
:
public ::boost::bimaps::detail::bimap_core<KeyTypeA,KeyTypeB,AP1,AP2,AP3>,
public ::boost::bimaps::detail::bimap_core<KeyTypeA,KeyTypeB,AP1,AP2,AP3>
::relation_set
{
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::
bimap_core<KeyTypeA,KeyTypeB,AP1,AP2,AP3> base_;
BOOST_DEDUCED_TYPENAME base_::core_type core;
public:
// metadata --------------------------------------------------------
/*
// The rest is computed in the core, because it is quite difficult to
// expose a nice interface with so many metaprogramming stuff.
// Here it is the complete metadat list.
// Map by {side} metadata
typedef -unspecified- {side}_tag;
typedef -unspecified- {side}_data_type;
typedef -unspecified- {side}_value_type;
typedef -unspecified- {side}_key_type;
typedef -unspecified- {side}_iterator;
typedef -unspecified- {side}_const_iterator;
------------------------------------------------------------------*/
typedef BOOST_DEDUCED_TYPENAME base_::left_set_type left_set_type;
typedef BOOST_DEDUCED_TYPENAME left_set_type::BOOST_NESTED_TEMPLATE
map_view_bind
<
BOOST_DEDUCED_TYPENAME base_::left_tag, base_
>::type left_map;
typedef BOOST_DEDUCED_TYPENAME base_::right_set_type right_set_type;
typedef BOOST_DEDUCED_TYPENAME right_set_type::BOOST_NESTED_TEMPLATE
map_view_bind
<
BOOST_DEDUCED_TYPENAME base_::right_tag, base_
>::type right_map;
/// Left map view
left_map left;
/// Right map view
right_map right;
bimap() :
base_::relation_set(
::boost::multi_index::get<
BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag
>(core)
),
left (
::boost::multi_index::get<
BOOST_DEDUCED_TYPENAME base_::logic_left_tag
>(core)
),
right (
::boost::multi_index::get<
BOOST_DEDUCED_TYPENAME base_::logic_right_tag
>(core)
)
{}
template< class InputIterator >
bimap(InputIterator first,InputIterator last) :
base_::relation_set(
::boost::multi_index::get<
BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag
>(core)
),
core(first,last),
left (
::boost::multi_index::get<
BOOST_DEDUCED_TYPENAME base_::logic_left_tag
>(core)
),
right (
::boost::multi_index::get<
BOOST_DEDUCED_TYPENAME base_::logic_right_tag
>(core)
)
{}
bimap(const bimap& x) :
base_::relation_set(
::boost::multi_index::get<
BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag
>(core)
),
core(x.core),
left (
::boost::multi_index::get<
BOOST_DEDUCED_TYPENAME base_::logic_left_tag
>(core)
),
right (
::boost::multi_index::get<
BOOST_DEDUCED_TYPENAME base_::logic_right_tag
>(core)
)
{}
bimap& operator=(const bimap& x)
{
core = x.core;
return *this;
}
// Projection of iterators
template< class IteratorType >
BOOST_DEDUCED_TYPENAME base_::left_iterator
project_left(IteratorType iter)
{
return core.template project<
BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base());
}
template< class IteratorType >
BOOST_DEDUCED_TYPENAME base_::left_const_iterator
project_left(IteratorType iter) const
{
return core.template project<
BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(iter.base());
}
template< class IteratorType >
BOOST_DEDUCED_TYPENAME base_::right_iterator
project_right(IteratorType iter)
{
return core.template project<
BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base());
}
template< class IteratorType >
BOOST_DEDUCED_TYPENAME base_::right_const_iterator
project_right(IteratorType iter) const
{
return core.template project<
BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(iter.base());
}
template< class IteratorType >
BOOST_DEDUCED_TYPENAME base_::relation_set::iterator
project_up(IteratorType iter)
{
return core.template project<
BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(iter.base());
}
template< class IteratorType >
BOOST_DEDUCED_TYPENAME base_::relation_set::const_iterator
project_up(IteratorType iter) const
{
return core.template project<
BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(iter.base());
}
// Support for tags
template< class Tag, class IteratorType >
BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
iterator_type_by<Tag,bimap>::type
project(IteratorType iter
BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))
{
return core.template project<Tag>(iter.base());
}
template< class Tag, class IteratorType >
BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
const_iterator_type_by<Tag,bimap>::type
project(IteratorType iter
BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag)) const
{
return core.template project<Tag>(iter.base());
}
template< class Tag >
struct map_by :
public ::boost::bimaps::support::map_type_by<Tag,bimap>::type
{
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
map_type_by<Tag,bimap>::type type;
private: map_by() {}
};
template< class Tag >
BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
map_type_by<Tag,bimap>::type &
by(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag))
{
return ::boost::bimaps::support::map_by<Tag>(*this);
}
template< class Tag >
const BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
map_type_by<Tag,bimap>::type &
by(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag)) const
{
return ::boost::bimaps::support::map_by<Tag>(*this);
}
#ifndef BOOST_BIMAP_DISABLE_SERIALIZATION
// Serialization support
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & serialization::make_nvp("mi_core",core);
}
#endif // BOOST_BIMAP_DISABLE_SERIALIZATION
};
} // namespace bimaps
} // namespace boost
/** \namespace boost::bimaps::support
\brief Metafunctions to help working with bimaps.
**/
/** \namespace boost::bimaps::views
\brief Bimap views.
**/
/** \namespace boost::bimaps::views::detail
\brief Bimap views details.
**/
// Include basic tools for user commodity
#include <boost/bimap/tags/tagged.hpp>
#include <boost/bimap/relation/member_at.hpp>
#include <boost/multi_index/detail/unbounded.hpp>
// Bring the most used namespaces directly to the user main namespace
namespace boost {
namespace bimaps {
using ::boost::bimaps::tags::tagged;
namespace member_at = ::boost::bimaps::relation::member_at;
using ::boost::multi_index::unbounded;
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_BIMAP_HPP
--- NEW FILE: list_of.hpp ---
// 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 list_of.hpp
/// \brief Include support for list constrains for the bimap container
#ifndef BOOST_BIMAP_LIST_OF_HPP
#define BOOST_BIMAP_LIST_OF_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/user_interface_config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/bimap/detail/concept_tags.hpp>
#include <boost/bimap/detail/generate_index_binder.hpp>
#include <boost/bimap/detail/generate_view_binder.hpp>
#include <boost/bimap/detail/generate_relation_binder.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/bimap/views/list_map_view.hpp>
#include <boost/bimap/views/list_set_view.hpp>
namespace boost {
namespace bimaps {
/// \brief Set Type Specification
/**
This struct is used to specify a set specification.
It is not a container, it is just a metaprogramming facility to
express the type of a set. Generally, this specification will
be used in other place to create a container.
It has the same syntax that an std::list instantiation, except
that the allocator cannot be specified. The rationale behind
this difference is that the allocator is not part of the set
type specification, rather it is a container configuration
parameter.
\code
using namespace support;
BOOST_STATIC_ASSERT( is_set_type_of< list_of<Type> >::value );
BOOST_STATIC_ASSERT
(
is_same
<
list_of<Type>::index_bind
<
KeyExtractor,
Tag
>::type,
sequenced< tag<Tag>, KeyExtractor >
>::value
);
typedef bimap
<
list_of<Type>, RightKeyType
> bimap_with_left_type_as_list;
BOOST_STATIC_ASSERT
(
is_same
<
list_of<Type>::map_view_bind
<
member_at::left,
bimap_with_left_type_as_list
>::type,
list_map_view< member_at::left, bimap_with_left_type_as_list >
>::value
);
\endcode
See also list_of_relation.
**/
template< class Type >
struct list_of : public ::boost::bimaps::detail::set_type_of_tag
{
/// Type of the object that will be stored in the list
typedef Type value_type;
BOOST_BIMAP_GENERATE_INDEX_BINDER_0CP_NO_EXTRACTOR(
// binds to
multi_index::sequenced
);
BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
// binds to
views::list_map_view
);
BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
// binds to
views::list_set_view
);
typedef mpl::bool_<true> mutable_key;
};
/// \brief List Of Relation Specification
/**
This struct is similar to list_of but it is bind logically to a
relation. It is used in the bimap instantiation to specify the
desired type of the main view. This struct implements internally
a metafunction named bind_to that manages the quite complicated
task of finding the right type of the set for the relation.
\code
template<class Relation>
struct bind_to
{
typedef -unspecified- type;
};
\endcode
See also list_of, is_set_type_of_relation.
**/
struct list_of_relation : public
::boost::bimaps::detail::set_type_of_relation_tag
{
BOOST_BIMAP_GENERATE_RELATION_BINDER_0CP(
// binds to
list_of
);
typedef mpl::bool_<true> left_mutable_key;
typedef mpl::bool_<true> right_mutable_key;
};
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_LIST_OF_HPP
--- NEW FILE: multiset_of.hpp ---
// 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 multiset_of.hpp
/// \brief Include support for multiset constrains for the bimap container
#ifndef BOOST_BIMAP_MULTISET_OF_HPP
#define BOOST_BIMAP_MULTISET_OF_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/user_interface_config.hpp>
#include <functional>
#include <boost/mpl/bool.hpp>
#include <boost/bimap/detail/concept_tags.hpp>
#include <boost/bimap/detail/generate_index_binder.hpp>
#include <boost/bimap/detail/generate_view_binder.hpp>
#include <boost/bimap/detail/generate_relation_binder.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/bimap/views/multimap_view.hpp>
#include <boost/bimap/views/multiset_view.hpp>
namespace boost {
namespace bimaps {
/// \brief Set Type Specification
/**
This struct is used to specify a multiset specification.
It is not a container, it is just a metaprogramming facility to
express the type of a set. Generally, this specification will
be used in other place to create a container.
It has the same syntax that an std::set instantiation, except
that the allocator cannot be specified. The rationale behind
this difference is that the allocator is not part of the set
type specification, rather it is a container configuration
parameter.
The first parameter is the type of the objects in the multiset,
and the second one is a Functor that compares them.
Bimap binding metafunctions can be used with this class in
the following way:
\code
using namespace support;
BOOST_STATIC_ASSERT( is_set_type_of< multiset_of<Type> >::value );
BOOST_STATIC_ASSERT
(
is_same
<
compute_index_type
<
multiset_of<Type,KeyCompare>,
KeyExtractor,
Tag
>::type
,
ordered_nonunique< tag<Tag>, KeyExtractor, KeyCompare >
>::value
);
typedef bimap
<
multiset_of<Type>, RightKeyType
> bimap_with_left_type_as_multiset;
BOOST_STATIC_ASSERT
(
is_same
<
compute_map_view_type
<
member_at::left,
bimap_with_left_type_as_multiset
>::type,
multimap_view< member_at::left, bimap_with_left_type_as_multiset >
>::value
);
\endcode
See also multiset_of_relation.
**/
template
<
class KeyType,
class KeyCompare = std::less< KeyType >
>
struct multiset_of : public ::boost::bimaps::detail::set_type_of_tag
{
/// Type of the object that will be stored in the set
typedef KeyType value_type;
/// Functor that compare two keys
typedef KeyCompare key_compare;
BOOST_BIMAP_GENERATE_INDEX_BINDER_1CP(
// binds to
multi_index::ordered_non_unique,
// with
key_compare
);
BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
// binds to
views::multimap_view
);
BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
// binds to
views::multiset_view
);
typedef mpl::bool_<false> mutable_key;
};
/// \brief Set Of Relation Specification
/**
This struct is similar to multiset_of but it is bind logically to a
relation. It is used in the bimap instantiation to specify the
desired type of the main view. This struct implements internally
a metafunction named bind_to that manages the quite complicated
task of finding the right type of the set for the relation.
\code
template<class Relation>
struct bind_to
{
typedef -unspecified- type;
};
\endcode
See also multiset_of, is_set_type_of_relation.
**/
template< class KeyCompare = std::less< _relation > >
struct multiset_of_relation : public
::boost::bimaps::detail::set_type_of_relation_tag
{
/// Functor that compare two keys
typedef KeyCompare key_compare;
BOOST_BIMAP_GENERATE_RELATION_BINDER_1CP(
// binds to
multiset_of,
// with
key_compare
);
typedef mpl::bool_<false> left_mutable_key;
typedef mpl::bool_<false> right_mutable_key;
};
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_MULTISET_OF_HPP
--- NEW FILE: set_of.hpp ---
// 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 set_of.hpp
/// \brief Include support for set constrains for the bimap container
#ifndef BOOST_BIMAP_SET_OF_HPP
#define BOOST_BIMAP_SET_OF_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/user_interface_config.hpp>
#include <functional>
#include <boost/mpl/bool.hpp>
#include <boost/bimap/detail/concept_tags.hpp>
#include <boost/bimap/detail/generate_index_binder.hpp>
#include <boost/bimap/detail/generate_view_binder.hpp>
#include <boost/bimap/detail/generate_relation_binder.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/bimap/views/map_view.hpp>
#include <boost/bimap/views/set_view.hpp>
namespace boost {
namespace bimaps {
/// \brief Set Type Specification
/**
This struct is used to specify a set specification.
It is not a container, it is just a metaprogramming facility to
express the type of a set. Generally, this specification will
be used in other place to create a container.
It has the same syntax that an std::set instantiation, except
that the allocator cannot be specified. The rationale behind
this difference is that the allocator is not part of the set
type specification, rather it is a container configuration
parameter.
The first parameter is the type of the objects in the set, and
the second one is a Functor that compares them.
Bimap binding metafunctions can be used with this class in
the following way:
\code
using namespace support;
BOOST_STATIC_ASSERT( is_set_type_of< set_of<Type> >::value );
BOOST_STATIC_ASSERT
(
is_same
<
set_of<Type,KeyCompare>::index_bind
<
KeyExtractor,
Tag
>::type,
ordered_unique< tag<Tag>, KeyExtractor, KeyCompare >
>::value
);
typedef bimap
<
set_of<Type>, RightKeyType
> bimap_with_left_type_as_set;
BOOST_STATIC_ASSERT
(
is_same
<
set_of<Type>::map_view_bind
<
member_at::left,
bimap_with_left_type_as_set
>::type,
map_view< member_at::left, bimap_with_left_type_as_set >
>::value
);
\endcode
See also set_of_relation.
**/
template
<
class KeyType,
class KeyCompare = std::less< KeyType >
>
struct set_of : public ::boost::bimaps::detail::set_type_of_tag
{
/// Type of the object that will be stored in the set
typedef KeyType value_type;
/// Functor that compare two keys
typedef KeyCompare key_compare;
BOOST_BIMAP_GENERATE_INDEX_BINDER_1CP(
// binds to
multi_index::ordered_unique,
// with
key_compare
);
BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
// binds to
views::map_view
);
BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
// binds to
views::set_view
);
typedef mpl::bool_<false> mutable_key;
};
/// \brief Set Of Relation Specification
/**
This struct is similar to set_of but it is bind logically to a
relation. It is used in the bimap instantiation to specify the
desired type of the main view. This struct implements internally
a metafunction named bind_to that manages the quite complicated
task of finding the right type of the set for the relation.
\code
template<class Relation>
struct bind_to
{
typedef -unspecified- type;
};
\endcode
See also set_of, is_set_type_of_relation.
**/
template< class KeyCompare = std::less< _relation > >
struct set_of_relation : public
::boost::bimaps::detail::set_type_of_relation_tag
{
/// Functor that compare two keys
typedef KeyCompare key_compare;
BOOST_BIMAP_GENERATE_RELATION_BINDER_1CP(
// binds to
set_of,
// with
key_compare
);
typedef mpl::bool_<false> left_mutable_key;
typedef mpl::bool_<false> right_mutable_key;
};
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_SET_OF_HPP
--- NEW FILE: unconstrained_set_of.hpp ---
// 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 unconstrained_set_of.hpp
/// \brief Include support for set constrains for the bimap container
#ifndef BOOST_BIMAP_UNCONSTRAINED_SET_OF_HPP
#define BOOST_BIMAP_UNCONSTRAINED_SET_OF_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/user_interface_config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/bimap/detail/concept_tags.hpp>
#include <boost/bimap/detail/generate_index_binder.hpp>
#include <boost/bimap/detail/generate_view_binder.hpp>
#include <boost/bimap/detail/generate_relation_binder.hpp>
#include <boost/bimap/views/unconstrained_map_view.hpp>
#include <boost/bimap/views/unconstrained_set_view.hpp>
namespace boost {
namespace bimaps {
/// \brief Set Type Specification
/**
This struct is used to specify a set specification.
It is not a container, it is just a metaprogramming facility to
express the type of a set. Generally, this specification will
be used in other place to create a container.
The first parameter is the type of the objects in the set.
\code
using namespace support;
BOOST_STATIC_ASSERT( is_set_type_of< unconstrained_set_of<Type> >::value );
\endcode
See also unconstrained_set_of_relation.
**/
template
<
class KeyType
>
struct unconstrained_set_of : public ::boost::bimaps::detail::set_type_of_tag
{
/// Type of the object that will be stored in the set
typedef KeyType value_type;
BOOST_BIMAP_GENERATE_INDEX_BINDER_FAKE
BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
// binds to
views::unconstrained_map_view
);
BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
// binds to
views::unconstrained_set_view
);
typedef mpl::bool_<true> mutable_key;
};
/// \brief Set Of Relation Specification
/**
This struct is similar to unconstrained_set_of but it is bind
logically to a relation. It is used in the bimap instantiation to
specify the desired type of the main view.
See also unconstrained_set_of, is_set_type_of_relation.
**/
struct unconstrained_set_of_relation : public
::boost::bimaps::detail::set_type_of_relation_tag
{
BOOST_BIMAP_GENERATE_RELATION_BINDER_0CP(
// binds to
unconstrained_set_of
);
typedef mpl::bool_<true> left_mutable_key;
typedef mpl::bool_<true> right_mutable_key;
};
#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
namespace detail {
template<class T>
struct is_unconstrained_set_of :
::boost::mpl::false_ {};
template<class T>
struct is_unconstrained_set_of< unconstrained_set_of<T> > :
::boost::mpl::true_ {};
} // namespace detail
#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
} // namespace bimaps
} // namespace boost
/** \struct boost::bimaps::detail::is_unconstrained_set_of
\brief Trait to check if a type is unconstrained_set_of.
\code
template< class T >
struct is_unconstrained_set_of;
\endcode
**/
#endif // BOOST_BIMAP_UNCONSTRAINED_SET_OF_HPP
--- NEW FILE: unordered_multiset_of.hpp ---
// 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 unordered_multiset_of.hpp
/// \brief Include support for unordered_multiset constrains for the bimap
container
#ifndef BOOST_BIMAP_UNORDERED_MULTISET_OF_HPP
#define BOOST_BIMAP_UNORDERED_MULTISET_OF_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/user_interface_config.hpp>
#include <functional>
#include <boost/functional/hash.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/bimap/detail/concept_tags.hpp>
#include <boost/bimap/detail/generate_index_binder.hpp>
#include <boost/bimap/detail/generate_view_binder.hpp>
#include <boost/bimap/detail/generate_relation_binder.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/bimap/views/unordered_multimap_view.hpp>
#include <boost/bimap/views/unordered_multiset_view.hpp>
namespace boost {
namespace bimaps {
/// \brief Set Type Specification
/**
This struct is used to specify an unordered_multiset specification.
It is not a container, it is just a metaprogramming facility to
express the type of a set. Generally, this specification will
be used in other place to create a container.
It has the same syntax that an tr1::unordered_multiset instantiation,
except that the allocator cannot be specified. The rationale behind
this difference is that the allocator is not part of the
unordered_multiset type specification, rather it is a container
configuration parameter.
The first parameter is the type of the objects in the set, the
second one is a Hash Functor that takes objects of this type, and
the third one is a Functor that compares them for equality.
Bimap binding metafunctions can be used with this class in
the following way:
\code
using namespace support;
BOOST_STATIC_ASSERT( is_set_type_of< unordered_multiset_of<Type> >::value );
BOOST_STATIC_ASSERT
(
is_same
<
compute_index_type
<
unordered_multiset_of<Type,HashFunctor,EqualKey>,
KeyExtractor,
Tag
>::type
,
hashed_nonunique< tag<Tag>, KeyExtractor, HashFunctor, EqualKey >
>::value
);
typedef bimap
<
unordered_multiset_of<Type>, RightKeyType
> bimap_with_left_type_as_unordered_multiset;
BOOST_STATIC_ASSERT
(
is_same
<
compute_map_view_type
<
member_at::left,
bimap_with_left_type_as_unordered_multiset
>::type,
unordered_multimap_view
<
member_at::left,
bimap_with_left_type_as_unordered_multiset
>
>::value
);
\endcode
See also unordered_multiset_of_relation.
**/
template
<
class KeyType,
class HashFunctor = hash< KeyType >,
class EqualKey = std::equal_to< KeyType >
>
struct unordered_multiset_of : public ::boost::bimaps::detail::set_type_of_tag
{
/// The type that will be stored in the container
typedef KeyType value_type;
/// Hash Functor that takes value_type objects
typedef HashFunctor hasher;
/// Functor that compare two value_type objects for equality
typedef EqualKey key_equal;
BOOST_BIMAP_GENERATE_INDEX_BINDER_2CP(
// binds to
multi_index::hashed_non_unique,
// with
hasher,
key_equal
);
BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
// binds to
views::unordered_multimap_view
);
BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
// binds to
views::unordered_multiset_view
);
typedef mpl::bool_<false> mutable_key;
};
/// \brief Set Of Relation Specification
/**
This struct is similar to unordered_multiset_of but it is bind logically
to a relation. It is used in the bimap instantiation to specify the
desired type of the main view. This struct implements internally
a metafunction named bind_to that manages the quite complicated
task of finding the right type of the set for the relation.
\code
template<class Relation>
struct bind_to
{
typedef -unspecified- type;
};
\endcode
See also unordered_multiset_of, is_set_type_of_relation.
**/
template
<
class HashFunctor = hash< _relation >,
class EqualKey = std::equal_to< _relation >
>
struct unordered_multiset_of_relation : public
::boost::bimaps::detail::set_type_of_relation_tag
{
/// Hash Functor that takes value_type objects
typedef HashFunctor hasher;
/// Functor that compare two value_type objects for equality
typedef EqualKey key_equal;
BOOST_BIMAP_GENERATE_RELATION_BINDER_2CP(
// binds to
unordered_multiset_of,
// with
hasher,
key_equal
);
typedef mpl::bool_<false> left_mutable_key;
typedef mpl::bool_<false> right_mutable_key;
};
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_UNORDERED_MULTISET_OF_HPP
--- NEW FILE: unordered_set_of.hpp ---
// 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 unordered_set_of.hpp
/// \brief Include support for unordered_set constrains for the bimap container
#ifndef BOOST_BIMAP_UNORDERED_SET_OF_HPP
#define BOOST_BIMAP_UNORDERED_SET_OF_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/user_interface_config.hpp>
#include <functional>
#include <boost/functional/hash.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/bimap/detail/concept_tags.hpp>
#include <boost/bimap/detail/generate_index_binder.hpp>
#include <boost/bimap/detail/generate_view_binder.hpp>
#include <boost/bimap/detail/generate_relation_binder.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/bimap/views/unordered_map_view.hpp>
#include <boost/bimap/views/unordered_set_view.hpp>
namespace boost {
namespace bimaps {
/// \brief Set Type Specification
/**
This struct is used to specify an unordered_set specification.
It is not a container, it is just a metaprogramming facility to
express the type of a set. Generally, this specification will
be used in other place to create a container.
It has the same syntax that an tr1::unordered_set instantiation,
except that the allocator cannot be specified. The rationale behind
this difference is that the allocator is not part of the
unordered_set type specification, rather it is a container
configuration parameter.
The first parameter is the type of the objects in the set, the
second one is a Hash Functor that takes objects of this type, and
the third one is a Functor that compares them for equality.
Bimap binding metafunctions can be used with this class in
the following way:
\code
using namespace support;
BOOST_STATIC_ASSERT( is_set_type_of< unordered_set_of<Type> >::value );
BOOST_STATIC_ASSERT
(
is_same
<
unordered_set_of<Type,HashFunctor,EqualKey>::index_bind
<
KeyExtractor,
Tag
>::type,
hashed_unique< tag<Tag>, KeyExtractor, HashFunctor, EqualKey >
>::value
);
typedef bimap
<
unordered_set_of<Type>, RightKeyType
> bimap_with_left_type_as_unordered_set;
BOOST_STATIC_ASSERT
(
is_same
<
unordered_set_of<Type>::map_view_bind
<
member_at::left,
bimap_with_left_type_as_unordered_set
>::type,
unordered_map_view
<
member_at::left,
bimap_with_left_type_as_unordered_set
>
>::value
);
\endcode
See also unordered_set_of_relation.
**/
template
<
class KeyType,
class HashFunctor = hash< KeyType >,
class EqualKey = std::equal_to< KeyType >
>
struct unordered_set_of : public ::boost::bimaps::detail::set_type_of_tag
{
/// The type that will be stored in the container
typedef KeyType value_type;
/// Hash Functor that takes value_type objects
typedef HashFunctor hasher;
/// Functor that compare two value_type objects for equality
typedef EqualKey key_equal;
BOOST_BIMAP_GENERATE_INDEX_BINDER_2CP(
// binds to
multi_index::hashed_unique,
// with
hasher,
key_equal
);
BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
// binds to
views::unordered_map_view
);
BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
// binds to
views::unordered_set_view
);
typedef mpl::bool_<false> mutable_key;
};
/// \brief Set Of Relation Specification
/**
This struct is similar to unordered_set_of but it is bind logically to
a relation. It is used in the bimap instantiation to specify the
desired type of the main view. This struct implements internally
a metafunction named bind_to that manages the quite complicated
task of finding the right type of the set for the relation.
\code
template<class Relation>
struct bind_to
{
typedef -unspecified- type;
};
\endcode
See also unordered_set_of, is_set_type_of_relation.
**/
template
<
class HashFunctor = hash< _relation >,
class EqualKey = std::equal_to< _relation >
>
struct unordered_set_of_relation : public
::boost::bimaps::detail::set_type_of_relation_tag
{
/// Hash Functor that takes value_type objects
typedef HashFunctor hasher;
/// Functor that compare two value_type objects for equality
typedef EqualKey key_equal;
BOOST_BIMAP_GENERATE_RELATION_BINDER_2CP(
// binds to
unordered_set_of,
// with
hasher,
key_equal
);
typedef mpl::bool_<false> left_mutable_key;
typedef mpl::bool_<false> right_mutable_key;
};
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_UNORDERED_SET_OF_HPP
--- NEW FILE: vector_of.hpp ---
// 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 vector_of.hpp
/// \brief Include support for vector constrains for the bimap container
#ifndef BOOST_BIMAP_VECTOR_OF_HPP
#define BOOST_BIMAP_VECTOR_OF_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/detail/user_interface_config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/bimap/detail/concept_tags.hpp>
#include <boost/bimap/detail/generate_index_binder.hpp>
#include <boost/bimap/detail/generate_view_binder.hpp>
#include <boost/bimap/detail/generate_relation_binder.hpp>
#include <boost/multi_index/random_access_index.hpp>
#include <boost/bimap/views/vector_map_view.hpp>
#include <boost/bimap/views/vector_set_view.hpp>
namespace boost {
namespace bimaps {
/// \brief Set Type Specification
/**
This struct is used to specify a set specification.
It is not a container, it is just a metaprogramming facility to
express the type of a set. Generally, this specification will
be used in other place to create a container.
It has the same syntax that an std::vector instantiation, except
that the allocator cannot be specified. The rationale behind
this difference is that the allocator is not part of the set
type specification, rather it is a container configuration
parameter.
The first parameter is the type of the objects in the set, and
the second one is a Functor that compares them.
Bimap binding metafunctions can be used with this class in
the following way:
\code
using namespace support;
BOOST_STATIC_ASSERT( is_set_type_of< vector_of<Type> >::value );
BOOST_STATIC_ASSERT
(
is_same
<
vector_of<Type>::index_bind
<
KeyExtractor,
Tag
>::type,
random_access< tag<Tag>, KeyExtractor >
>::value
);
typedef bimap
<
vector_of<Type>, RightKeyType
> bimap_with_left_type_as_vector;
BOOST_STATIC_ASSERT
(
is_same
<
vector_of<Type>::map_view_bind
<
member_at::left,
bimap_with_left_type_as_vector
>::type,
vector_map_view< member_at::left, bimap_with_left_type_as_vector >
>::value
);
\endcode
See also vector_of_relation.
**/
template< class Type >
struct vector_of : public ::boost::bimaps::detail::set_type_of_tag
{
/// Type of the object that will be stored in the set
typedef Type value_type;
BOOST_BIMAP_GENERATE_INDEX_BINDER_0CP_NO_EXTRACTOR(
// binds to
multi_index::random_access
);
BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
// binds to
views::vector_map_view
);
BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
// binds to
views::vector_set_view
);
typedef mpl::bool_<true> mutable_key;
};
/// \brief Set Of Relation Specification
/**
This struct is similar to vector_of but it is bind logically to a
relation. It is used in the bimap instantiation to specify the
desired type of the main view. This struct implements internally
a metafunction named bind_to that manages the quite complicated
task of finding the right type of the set for the relation.
\code
template<class Relation>
struct bind_to
{
typedef -unspecified- type;
};
\endcode
See also vector_of, is_set_type_of_relation.
**/
struct vector_of_relation : public
::boost::bimaps::detail::set_type_of_relation_tag
{
BOOST_BIMAP_GENERATE_RELATION_BINDER_0CP(
// binds to
vector_of
);
typedef mpl::bool_<true> left_mutable_key;
typedef mpl::bool_<true> right_mutable_key;
};
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VECTOR_OF_HPP
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs