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,182 @@
// 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 views/list_map_view.hpp
/// \brief View of a side of a bimap.
#ifndef BOOST_BIMAP_VIEWS_LIST_MAP_VIEW_HPP
#define BOOST_BIMAP_VIEWS_LIST_MAP_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/list_map_adaptor.hpp>
#include <boost/bimap/relation/support/pair_by.hpp>
#include <boost/bimap/support/iterator_type_by.hpp>
#include <boost/bimap/detail/map_view_base.hpp>
#include <boost/bimap/relation/support/data_extractor.hpp>
#include <boost/bimap/relation/detail/to_mutable_relation_functor.hpp>
namespace boost {
namespace bimaps {
namespace views {
#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
template< class Tag, class BimapType >
struct list_map_view_base
{
typedef ::boost::bimaps::container_adaptor::list_map_adaptor
<
BOOST_DEDUCED_TYPENAME BimapType::core_type::BOOST_NESTED_TEMPLATE index<Tag>::type,
BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
iterator_type_by<Tag,BimapType>::type,
BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
const_iterator_type_by<Tag,BimapType>::type,
BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
reverse_iterator_type_by<Tag,BimapType>::type,
BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
const_reverse_iterator_type_by<Tag,BimapType>::type,
::boost::bimaps::container_adaptor::support::iterator_facade_to_base
<
BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
iterator_type_by<Tag,BimapType>::type,
BOOST_DEDUCED_TYPENAME ::boost::bimaps::support::
const_iterator_type_by<Tag,BimapType>::type
>,
::boost::mpl::na,
::boost::mpl::na,
::boost::bimaps::relation::detail::
pair_to_relation_functor<Tag, BOOST_DEDUCED_TYPENAME BimapType::relation >,
::boost::bimaps::relation::support::
get_pair_functor<Tag, BOOST_DEDUCED_TYPENAME BimapType::relation >,
BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::data_extractor
<
Tag,
BOOST_DEDUCED_TYPENAME BimapType::relation
>::type
> type;
};
#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
/// \brief View of a side of a bimap.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core.
See also const_list_map_view.
**/
template< class Tag, class BimapType >
class list_map_view
:
public list_map_view_base<Tag,BimapType>::type,
public ::boost::bimaps::detail::
map_view_base< list_map_view<Tag,BimapType>,Tag,BimapType >
{
typedef BOOST_DEDUCED_TYPENAME list_map_view_base<Tag,BimapType>::type base_;
BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(list_map_view,Tag,BimapType)
public:
typedef BOOST_DEDUCED_TYPENAME base_::value_type::info_type info_type;
list_map_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) :
base_(c) {}
list_map_view & operator=(const list_map_view & v)
{
this->base() = v.base();
return *this;
}
BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_)
BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_)
// Rearrange Operations
void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
BOOST_DEDUCED_TYPENAME base_::iterator i)
{
this->base().relocate(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(i)
);
}
void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
BOOST_DEDUCED_TYPENAME base_::iterator first,
BOOST_DEDUCED_TYPENAME base_::iterator last)
{
this->base().relocate(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(first),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(last)
);
}
};
} // namespace views
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME) \
typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME \
BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
/*===========================================================================*/
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,reverse_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator) \
/*===========================================================================*/
namespace detail {
template< class Tag, class BimapType >
struct left_map_view_extra_typedefs< ::boost::bimaps::views::list_map_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::list_map_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,left)
};
template< class Tag, class BimapType >
struct right_map_view_extra_typedefs< ::boost::bimaps::views::list_map_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::list_map_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,right)
};
} // namespace detail
/*===========================================================================*/
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
/*===========================================================================*/
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_LIST_MAP_VIEW_HPP

View File

@@ -0,0 +1,109 @@
// 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 views/list_set_view.hpp
/// \brief View of a side of a bimap that is signature compatible with std::list.
#ifndef BOOST_BIMAP_VIEWS_LIST_SET_VIEW_HPP
#define BOOST_BIMAP_VIEWS_LIST_SET_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/list_adaptor.hpp>
#include <boost/bimap/detail/set_view_base.hpp>
#include <boost/bimap/detail/map_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a bimap that is signature compatible with std::list.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a std::list.
See also const_list_set_view.
**/
template< class CoreIndex >
class list_set_view
:
public BOOST_BIMAP_SEQUENCED_SET_VIEW_CONTAINER_ADAPTOR(
list_adaptor,
CoreIndex,
reverse_iterator, const_reverse_iterator
),
public ::boost::bimaps::detail::
set_view_base< list_set_view< CoreIndex >, CoreIndex >
{
BOOST_BIMAP_SET_VIEW_BASE_FRIEND(list_set_view,CoreIndex)
typedef BOOST_BIMAP_SEQUENCED_SET_VIEW_CONTAINER_ADAPTOR(
list_adaptor,
CoreIndex,
reverse_iterator, const_reverse_iterator
) base_;
public:
list_set_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) :
base_(c) {}
list_set_view & operator=(const list_set_view & v)
{
this->base() = v.base();
return *this;
}
BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_)
BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_)
// Rearrange Operations
void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
BOOST_DEDUCED_TYPENAME base_::iterator i)
{
this->base().relocate(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(i)
);
}
void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
BOOST_DEDUCED_TYPENAME base_::iterator first,
BOOST_DEDUCED_TYPENAME base_::iterator last)
{
this->base().relocate(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(first),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(last)
);
}
};
} // namespace views
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_LIST_SET_VIEW_HPP

View File

@@ -0,0 +1,156 @@
// 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 views/map_view.hpp
/// \brief View of a side of a bimap that is signature compatible with std::map.
#ifndef BOOST_BIMAP_VIEWS_MAP_VIEW_HPP
#define BOOST_BIMAP_VIEWS_MAP_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/map_adaptor.hpp>
#include <boost/bimap/detail/map_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a side of a bimap that is signature compatible with std::map.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a std::map.
See also const_map_view.
**/
template< class Tag, class BimapType >
class map_view
:
public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
map_adaptor,
Tag,BimapType,
reverse_iterator_type_by,const_reverse_iterator_type_by
),
public ::boost::bimaps::detail::
map_view_base< map_view<Tag,BimapType>,Tag,BimapType >,
public ::boost::bimaps::detail::
unique_map_view_access< map_view<Tag,BimapType>, Tag, BimapType>::type
{
typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
map_adaptor,
Tag,BimapType,
reverse_iterator_type_by,const_reverse_iterator_type_by
) base_;
BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(map_view,Tag,BimapType)
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::
unique_map_view_access<
map_view<Tag,BimapType>, Tag, BimapType
>::type unique_map_view_access_;
public:
typedef BOOST_DEDUCED_TYPENAME base_::value_type::info_type info_type;
map_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) : base_(c) {}
using unique_map_view_access_::at;
using unique_map_view_access_::operator[];
BOOST_BIMAP_MAP_VIEW_RANGE_IMPLEMENTATION(base_)
map_view & operator=(const map_view & v)
{
this->base() = v.base();
return *this;
}
// It can be used enable_if here but the error message when there
// is no info is very clear like this
template< class CompatibleKey >
const info_type & info_at(const CompatibleKey& k) const
{
BOOST_DEDUCED_TYPENAME base_::const_iterator iter = this->find(k);
if( iter == this->end() )
{
::boost::throw_exception(
std::out_of_range("bimap<>: invalid key")
);
}
return iter->info;
}
template< class CompatibleKey >
info_type & info_at(const CompatibleKey& k)
{
BOOST_DEDUCED_TYPENAME base_::iterator iter = this->find(k);
if( iter == this->end() )
{
::boost::throw_exception(
std::out_of_range("bimap<>: invalid key")
);
}
return iter->info;
}
};
} // namespace views
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME) \
typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME \
BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
/*===========================================================================*/
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,reverse_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,range_type) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_range_type) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,key_compare)
/*===========================================================================*/
namespace detail {
template< class Tag, class BimapType >
struct left_map_view_extra_typedefs< ::boost::bimaps::views::map_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::map_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,left)
};
template< class Tag, class BimapType >
struct right_map_view_extra_typedefs< ::boost::bimaps::views::map_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::map_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,right)
};
} // namespace detail
/*===========================================================================*/
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
/*===========================================================================*/
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_MAP_VIEW_HPP

View File

@@ -0,0 +1,123 @@
// 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 views/multimap_view.hpp
/// \brief View of a side of a bimap that is signature compatible with std::multimap.
#ifndef BOOST_BIMAP_VIEWS_MULTIMAP_VIEW_HPP
#define BOOST_BIMAP_VIEWS_MULTIMAP_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/multimap_adaptor.hpp>
#include <boost/bimap/detail/non_unique_views_helper.hpp>
#include <boost/bimap/support/iterator_type_by.hpp>
#include <boost/bimap/detail/map_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a side of a bimap that is signature compatible with std::multimap.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a std::multimap.
See also const_multimap_view.
**/
template< class Tag, class BimapType >
class multimap_view
:
public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
multimap_adaptor,
Tag,BimapType,
reverse_iterator_type_by,const_reverse_iterator_type_by
),
public ::boost::bimaps::detail::
map_view_base< multimap_view<Tag,BimapType>,Tag,BimapType >
{
typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
multimap_adaptor,
Tag,BimapType,
reverse_iterator_type_by,const_reverse_iterator_type_by
) base_;
BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(multimap_view,Tag,BimapType)
public:
typedef BOOST_DEDUCED_TYPENAME base_::value_type::info_type info_type;
multimap_view(BOOST_DEDUCED_TYPENAME base_::base_type & c)
: base_(c) {}
BOOST_BIMAP_MAP_VIEW_RANGE_IMPLEMENTATION(base_)
multimap_view & operator=(const multimap_view & v)
{
this->base() = v.base();
return *this;
}
BOOST_BIMAP_NON_UNIQUE_VIEW_INSERT_FUNCTIONS
};
} // namespace views
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME) \
typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME \
BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
/*===========================================================================*/
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,reverse_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,range_type) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_range_type) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,key_compare)
/*===========================================================================*/
namespace detail {
template< class Tag, class BimapType >
struct left_map_view_extra_typedefs< ::boost::bimaps::views::multimap_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::multimap_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,left)
};
template< class Tag, class BimapType >
struct right_map_view_extra_typedefs< ::boost::bimaps::views::multimap_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::multimap_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,right)
};
} // namespace detail
/*===========================================================================*/
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
/*===========================================================================*/
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_MAP_VIEW_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 views/multiset_view.hpp
/// \brief View of a bimap that is signature compatible with std::multiset.
#ifndef BOOST_BIMAP_VIEWS_MULTISET_VIEW_HPP
#define BOOST_BIMAP_VIEWS_MULTISET_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/multiset_adaptor.hpp>
#include <boost/bimap/container_adaptor/detail/comparison_adaptor.hpp>
#include <boost/bimap/detail/non_unique_views_helper.hpp>
#include <boost/bimap/detail/set_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a bimap that is signature compatible with std::multiset.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a std::multiset.
See also const_multiset_view.
**/
template< class CoreIndex >
class multiset_view
:
public BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
multiset_adaptor,
CoreIndex,
reverse_iterator,
const_reverse_iterator
),
public ::boost::bimaps::detail::
set_view_base< multiset_view< CoreIndex >, CoreIndex >
{
BOOST_BIMAP_SET_VIEW_BASE_FRIEND(multiset_view, CoreIndex)
typedef BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
multiset_adaptor,
CoreIndex,
reverse_iterator,
const_reverse_iterator
) base_;
public:
multiset_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) : base_(c) {}
/*
template< class LowerBounder, class UpperBounder >
std::pair<BOOST_DEDUCED_TYPENAME base_::const_iterator,
BOOST_DEDUCED_TYPENAME base_::const_iterator>
range(LowerBounder lower,UpperBounder upper) const
{
return this->base().range(
::boost::bimaps::container_adaptor::detail::unary_check_adaptor
<
LowerBounder,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( lower, this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>() ),
::boost::bimaps::container_adaptor::detail::unary_check_adaptor
<
UpperBounder,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( upper, this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>() )
);
}
*/
multiset_view & operator=(const multiset_view & v)
{
this->base() = v.base(); return *this;
}
BOOST_BIMAP_NON_UNIQUE_VIEW_INSERT_FUNCTIONS
};
} // namespace views
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_MULTISET_VIEW_HPP

View File

@@ -0,0 +1,106 @@
// 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 views/set_view.hpp
/// \brief View of a bimap that is signature compatible with std::set.
#ifndef BOOST_BIMAP_VIEWS_SET_VIEW_HPP
#define BOOST_BIMAP_VIEWS_SET_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/set_adaptor.hpp>
#include <boost/bimap/detail/set_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a bimap that is signature compatible with std::set.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a std::set.
See also const_set_view.
**/
template< class CoreIndex >
class set_view
:
public BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
set_adaptor,
CoreIndex,
reverse_iterator, const_reverse_iterator
),
public ::boost::bimaps::detail::
set_view_base< set_view< CoreIndex >, CoreIndex >
{
typedef BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
set_adaptor,
CoreIndex,
reverse_iterator, const_reverse_iterator
) base_;
BOOST_BIMAP_SET_VIEW_BASE_FRIEND(set_view,CoreIndex)
public:
set_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) : base_(c) {}
/*
template< class LowerBounder, class UpperBounder >
std::pair<BOOST_DEDUCED_TYPENAME base_::const_iterator,
BOOST_DEDUCED_TYPENAME base_::const_iterator>
range(LowerBounder lower,UpperBounder upper) const
{
return this->base().range(
::boost::bimaps::container_adaptor::detail::unary_check_adaptor
<
LowerBounder,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( lower, this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>() ),
::boost::bimaps::container_adaptor::detail::unary_check_adaptor
<
UpperBounder,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( upper, this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>() )
);
}
*/
set_view & operator=(const set_view & v)
{
this->base() = v.base();
return *this;
}
};
} // namespace views
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_SET_VIEW_HPP

View File

@@ -0,0 +1,44 @@
// 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 views/unconstrained_map_view.hpp
/// \brief Unconstrained view of a side of a bimap.
#ifndef BOOST_BIMAP_VIEWS_UNCONSTRAINED_MAP_VIEW_HPP
#define BOOST_BIMAP_VIEWS_UNCONSTRAINED_MAP_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief Unconstrained view of a side of a bimap.
template< class Tag, class BimapType>
class unconstrained_map_view
{
public:
template< class T >
unconstrained_map_view(const T & t) {}
typedef void reference;
typedef void const_reference;
typedef void info_type;
};
} // namespace views
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_UNCONSTRAINED_MAP_VIEW_HPP

View File

@@ -0,0 +1,42 @@
// 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 views/unconstrained_set_view.hpp
/// \brief Unconstrained view of a bimap.
#ifndef BOOST_BIMAP_VIEWS_UNCONSTRAINED_SET_VIEW_HPP
#define BOOST_BIMAP_VIEWS_UNCONSTRAINED_SET_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief Unconstrained view of a bimap.
template< class CoreIndex >
class unconstrained_set_view
{
public:
template< class T >
unconstrained_set_view(const T & t) {}
typedef void iterator;
typedef void const_iterator;
};
} // namespace views
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_UNCONSTRAINED_SET_VIEW_HPP

View File

@@ -0,0 +1,174 @@
// 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 views/unordered_map_view.hpp
/// \brief View of a side of a bimap that is signature compatible with tr1::unordered_map.
#ifndef BOOST_BIMAP_VIEWS_UNOREDERED_MAP_VIEW_HPP
#define BOOST_BIMAP_VIEWS_UNOREDERED_MAP_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <utility>
#include <boost/bimap/container_adaptor/unordered_map_adaptor.hpp>
#include <boost/bimap/detail/map_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief Map View of a bimap, signature compatible with tr1::unordered_map.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a tr1::unordered_map.
See also const_unordered_map_view.
**/
template< class Tag, class BimapType >
class unordered_map_view
:
public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
unordered_map_adaptor,
Tag,BimapType,
local_iterator_type_by,const_local_iterator_type_by
),
public ::boost::bimaps::detail::map_view_base<
unordered_map_view<Tag,BimapType>,Tag,BimapType >,
public ::boost::bimaps::detail::
unique_map_view_access<
unordered_map_view<Tag,BimapType>, Tag, BimapType>::type
{
typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
unordered_map_adaptor,
Tag,BimapType,
local_iterator_type_by,const_local_iterator_type_by
) base_;
BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(unordered_map_view,Tag,BimapType)
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::detail::
unique_map_view_access<
unordered_map_view<Tag,BimapType>, Tag, BimapType
>::type unique_map_view_access_;
public:
typedef std::pair<
BOOST_DEDUCED_TYPENAME base_::iterator,
BOOST_DEDUCED_TYPENAME base_::iterator
> range_type;
typedef std::pair<
BOOST_DEDUCED_TYPENAME base_::const_iterator,
BOOST_DEDUCED_TYPENAME base_::const_iterator
> const_range_type;
typedef BOOST_DEDUCED_TYPENAME base_::value_type::info_type info_type;
unordered_map_view(BOOST_DEDUCED_TYPENAME base_::base_type & c)
: base_(c) {}
using unique_map_view_access_::at;
using unique_map_view_access_::operator[];
unordered_map_view & operator=(const unordered_map_view & v)
{
this->base() = v.base();
return *this;
}
// It can be used enable_if here but the error message when there
// is no info is very clear like this
template< class CompatibleKey >
const info_type & info_at(const CompatibleKey& k) const
{
BOOST_DEDUCED_TYPENAME base_::const_iterator iter = this->find(k);
if( iter == this->end() )
{
::boost::throw_exception(
std::out_of_range("bimap<>: invalid key")
);
}
return iter->info;
}
template< class CompatibleKey >
info_type & info_at(const CompatibleKey& k)
{
BOOST_DEDUCED_TYPENAME base_::iterator iter = this->find(k);
if( iter == this->end() )
{
::boost::throw_exception(
std::out_of_range("bimap<>: invalid key")
);
}
return iter->info;
}
};
} // namespace views
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME) \
typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME \
BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
/*===========================================================================*/
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,local_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_local_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,range_type) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_range_type) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,hasher) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,key_equal)
/*===========================================================================*/
namespace detail {
template< class Tag, class BimapType >
struct left_map_view_extra_typedefs< ::boost::bimaps::views::unordered_map_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::unordered_map_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,left)
};
template< class Tag, class BimapType >
struct right_map_view_extra_typedefs< ::boost::bimaps::views::unordered_map_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::unordered_map_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,right)
};
} // namespace detail
/*===========================================================================*/
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
/*===========================================================================*/
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_UNOREDERED_MAP_VIEW_HPP

View File

@@ -0,0 +1,136 @@
// 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 views/unordered_multimap_view.hpp
/// \brief View of a side of a bimap that is signature compatible with tr1::unordered_multimap.
#ifndef BOOST_BIMAP_VIEWS_UNOREDERED_MULTIMAP_VIEW_HPP
#define BOOST_BIMAP_VIEWS_UNOREDERED_MULTIMAP_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <utility>
#include <boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp>
#include <boost/bimap/detail/non_unique_views_helper.hpp>
#include <boost/bimap/support/iterator_type_by.hpp>
#include <boost/bimap/detail/map_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a side of a bimap that is signature compatible with tr1::unordered_multimap.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a tr1::unordered_multimap.
See also const_unordered_multimap_view.
**/
template< class Tag, class BimapType >
class unordered_multimap_view
:
public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
unordered_multimap_adaptor,
Tag,BimapType,
local_iterator_type_by,const_local_iterator_type_by
),
public ::boost::bimaps::detail::map_view_base<
unordered_multimap_view<Tag,BimapType>,Tag,BimapType >
{
typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
unordered_multimap_adaptor,
Tag,BimapType,
local_iterator_type_by,const_local_iterator_type_by
) base_;
BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(unordered_multimap_view,Tag,BimapType)
public:
typedef std::pair<
BOOST_DEDUCED_TYPENAME base_::iterator,
BOOST_DEDUCED_TYPENAME base_::iterator
> range_type;
typedef std::pair<
BOOST_DEDUCED_TYPENAME base_::const_iterator,
BOOST_DEDUCED_TYPENAME base_::const_iterator
> const_range_type;
typedef BOOST_DEDUCED_TYPENAME base_::value_type::info_type info_type;
unordered_multimap_view(BOOST_DEDUCED_TYPENAME base_::base_type & c)
: base_(c) {}
BOOST_BIMAP_NON_UNIQUE_VIEW_INSERT_FUNCTIONS
unordered_multimap_view & operator=(const unordered_multimap_view & v)
{
this->base() = v.base();
return *this;
}
};
} // namespace views
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME) \
typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME \
BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
/*===========================================================================*/
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,local_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_local_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,range_type) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_range_type) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,hasher) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,key_equal)
/*===========================================================================*/
namespace detail {
template< class Tag, class BimapType >
struct left_map_view_extra_typedefs< ::boost::bimaps::views::unordered_multimap_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::unordered_multimap_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,left)
};
template< class Tag, class BimapType >
struct right_map_view_extra_typedefs< ::boost::bimaps::views::unordered_multimap_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::unordered_multimap_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,right)
};
} // namespace detail
/*===========================================================================*/
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
/*===========================================================================*/
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_UNOREDERED_MULTIMAP_VIEW_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 views/unordered_multiset_view.hpp
/// \brief View of a bimap that is signature compatible with tr1::unordered_multiset.
#ifndef BOOST_BIMAP_VIEWS_UNORDERED_MULTISET_VIEW_HPP
#define BOOST_BIMAP_VIEWS_UNORDERED_MULTISET_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/unordered_multiset_adaptor.hpp>
#include <boost/bimap/detail/non_unique_views_helper.hpp>
#include <boost/bimap/detail/set_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a bimap that is signature compatible with std::unordered_multiset.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a std::unordered_multiset.
See also const_unordered_multiset_view.
**/
template< class CoreIndex >
class unordered_multiset_view
:
public BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
unordered_multiset_adaptor,
CoreIndex,
local_iterator,
const_local_iterator
),
public ::boost::bimaps::detail::
set_view_base< unordered_multiset_view< CoreIndex >, CoreIndex >
{
BOOST_BIMAP_SET_VIEW_BASE_FRIEND(unordered_multiset_view,CoreIndex)
typedef BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
unordered_multiset_adaptor,
CoreIndex,
local_iterator,
const_local_iterator
) base_;
public:
unordered_multiset_view(BOOST_DEDUCED_TYPENAME base_::base_type & c)
: base_(c) {}
BOOST_BIMAP_NON_UNIQUE_VIEW_INSERT_FUNCTIONS
unordered_multiset_view & operator=(const unordered_multiset_view & v)
{
this->base() = v.base();
return *this;
}
};
} // namespace views
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_UNORDERED_MULTISET_VIEW_HPP

View File

@@ -0,0 +1,78 @@
// 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 views/unordered_set_view.hpp
/// \brief View of a bimap that is signature compatible with tr1::unordered_set.
#ifndef BOOST_BIMAP_VIEWS_UNORDERED_SET_VIEW_HPP
#define BOOST_BIMAP_VIEWS_UNORDERED_SET_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/unordered_set_adaptor.hpp>
#include <boost/bimap/detail/set_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a bimap that is signature compatible with std::unordered_set.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a std::unordered_set.
See also const_unordered_set_view.
**/
template< class CoreIndex >
class unordered_set_view
:
public BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
unordered_set_adaptor,
CoreIndex,
local_iterator,
const_local_iterator
),
public ::boost::bimaps::detail::
set_view_base< unordered_set_view< CoreIndex >, CoreIndex >
{
BOOST_BIMAP_SET_VIEW_BASE_FRIEND(unordered_set_view,CoreIndex)
typedef BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
unordered_set_adaptor,
CoreIndex,
local_iterator,
const_local_iterator
) base_;
public:
unordered_set_view(BOOST_DEDUCED_TYPENAME base_::base_type & c)
: base_(c) {}
unordered_set_view & operator=(const unordered_set_view & v)
{
this->base() = v.base();
return *this;
}
};
} // namespace views
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_UNORDERED_SET_VIEW_HPP

View File

@@ -0,0 +1,306 @@
// 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 views/vector_map_view.hpp
/// \brief View of a side of a bimap.
#ifndef BOOST_BIMAP_VIEWS_VECTOR_MAP_VIEW_HPP
#define BOOST_BIMAP_VIEWS_VECTOR_MAP_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/vector_map_adaptor.hpp>
#include <boost/bimap/support/iterator_type_by.hpp>
#include <boost/bimap/detail/map_view_base.hpp>
#include <boost/bimap/container_adaptor/detail/comparison_adaptor.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a side of a bimap.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core.
See also const_map_view.
**/
template< class Tag, class BimapType >
class vector_map_view
:
public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
vector_map_adaptor,
Tag,BimapType,
reverse_iterator_type_by, const_reverse_iterator_type_by
),
public ::boost::bimaps::detail::
map_view_base< vector_map_view<Tag,BimapType>,Tag,BimapType >
{
typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
vector_map_adaptor,
Tag,BimapType,
reverse_iterator_type_by, const_reverse_iterator_type_by
) base_;
BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(vector_map_view,Tag,BimapType)
typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::data_extractor
<
Tag,
BOOST_DEDUCED_TYPENAME BimapType::relation
>::type key_from_base_value;
public:
typedef BOOST_DEDUCED_TYPENAME base_::value_type::info_type info_type;
vector_map_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) :
base_(c) {}
vector_map_view & operator=(const vector_map_view & v)
{
this->base() = v.base();
return *this;
}
BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_)
BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_)
// Lists operations
void splice(BOOST_DEDUCED_TYPENAME base_::iterator position, vector_map_view & x)
{
this->base().splice(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
x.base()
);
}
void splice(BOOST_DEDUCED_TYPENAME base_::iterator position,
vector_map_view & x,
BOOST_DEDUCED_TYPENAME base_::iterator i)
{
this->base().splice(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
x.base(),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(i)
);
}
void splice(BOOST_DEDUCED_TYPENAME base_::iterator position,
vector_map_view & x,
BOOST_DEDUCED_TYPENAME base_::iterator first,
BOOST_DEDUCED_TYPENAME base_::iterator last)
{
this->base().splice(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
x.base(),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(first),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(last)
);
}
void remove(BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::value_type >::param_type value)
{
this->base().remove(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_to_base>()(value)
);
}
template< class Predicate >
void remove_if(Predicate pred)
{
this->base().remove_if(
::boost::bimaps::container_adaptor::detail::unary_check_adaptor
<
Predicate,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
key_from_base_value
>( pred, key_from_base_value() )
);
}
void unique()
{
this->base().unique(
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
std::equal_to<BOOST_DEDUCED_TYPENAME base_::key_type>,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
key_from_base_value
>(std::equal_to<BOOST_DEDUCED_TYPENAME base_::key_type>(),
key_from_base_value() )
);
}
template< class BinaryPredicate >
void unique(BinaryPredicate binary_pred)
{
this->base().unique(
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
BinaryPredicate,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
key_from_base_value
>( binary_pred, key_from_base_value() )
);
}
void merge(vector_map_view & x)
{
this->base().merge(x.base(),
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
std::less<BOOST_DEDUCED_TYPENAME base_::key_type>,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
key_from_base_value
>( std::less<BOOST_DEDUCED_TYPENAME base_::key_type>(),
key_from_base_value() )
);
}
template< class Compare >
void merge(vector_map_view & x, Compare comp)
{
this->base().merge(x.base(),
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
Compare,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
key_from_base_value
>( comp, key_from_base_value() )
);
}
void sort()
{
this->base().sort(
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
std::less<BOOST_DEDUCED_TYPENAME base_::key_type>,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
key_from_base_value
>( std::less<BOOST_DEDUCED_TYPENAME base_::key_type>(),
key_from_base_value() )
);
}
template< class Compare >
void sort(Compare comp)
{
this->base().sort(
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
Compare,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
key_from_base_value
>( comp, key_from_base_value() )
);
}
void reverse()
{
this->base().reverse();
}
// Rearrange Operations
void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
BOOST_DEDUCED_TYPENAME base_::iterator i)
{
this->base().relocate(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(i)
);
}
void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
BOOST_DEDUCED_TYPENAME base_::iterator first,
BOOST_DEDUCED_TYPENAME base_::iterator last)
{
this->base().relocate(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(first),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(last)
);
}
};
} // namespace views
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME) \
typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME \
BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
/*===========================================================================*/
/*===========================================================================*/
#define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,reverse_iterator) \
BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator) \
/*===========================================================================*/
namespace detail {
template< class Tag, class BimapType >
struct left_map_view_extra_typedefs< ::boost::bimaps::views::vector_map_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::vector_map_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,left)
};
template< class Tag, class BimapType >
struct right_map_view_extra_typedefs< ::boost::bimaps::views::vector_map_view<Tag,BimapType> >
{
private: typedef ::boost::bimaps::views::vector_map_view<Tag,BimapType> map_view_;
public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,right)
};
} // namespace detail
/*===========================================================================*/
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
#undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
/*===========================================================================*/
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_VECTOR_MAP_VIEW_HPP

View File

@@ -0,0 +1,279 @@
// 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 views/vector_set_view.hpp
/// \brief View of a side of a bimap that is signature compatible with std::vector.
#ifndef BOOST_BIMAP_VIEWS_VECTOR_SET_VIEW_HPP
#define BOOST_BIMAP_VIEWS_VECTOR_SET_VIEW_HPP
#if defined(_MSC_VER) && (_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/vector_adaptor.hpp>
#include <boost/bimap/container_adaptor/detail/comparison_adaptor.hpp>
#include <boost/bimap/detail/set_view_base.hpp>
#include <boost/bimap/detail/map_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a bimap that is signature compatible with std::vector.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a std::vector.
See also const_set_view.
**/
template< class CoreIndex >
class vector_set_view
:
public BOOST_BIMAP_SEQUENCED_SET_VIEW_CONTAINER_ADAPTOR(
vector_adaptor,
CoreIndex,
reverse_iterator, const_reverse_iterator
),
public ::boost::bimaps::detail::
set_view_base< vector_set_view< CoreIndex >, CoreIndex >
{
BOOST_BIMAP_SET_VIEW_BASE_FRIEND(vector_set_view,CoreIndex)
typedef BOOST_BIMAP_SEQUENCED_SET_VIEW_CONTAINER_ADAPTOR(
vector_adaptor,
CoreIndex,
reverse_iterator, const_reverse_iterator
) base_;
public:
vector_set_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) :
base_(c) {}
vector_set_view & operator=(const vector_set_view & v)
{
this->base() = v.base();
return *this;
}
BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_)
BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_)
// List operations
void splice(BOOST_DEDUCED_TYPENAME base_::iterator position,
vector_set_view & x)
{
this->base().splice(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
x.base()
);
}
void splice(BOOST_DEDUCED_TYPENAME base_::iterator position,
vector_set_view & x,
BOOST_DEDUCED_TYPENAME base_::iterator i)
{
this->base().splice(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
x.base(),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(i)
);
}
void splice(BOOST_DEDUCED_TYPENAME base_::iterator position,
vector_set_view & x,
BOOST_DEDUCED_TYPENAME base_::iterator first,
BOOST_DEDUCED_TYPENAME base_::iterator last)
{
this->base().splice(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
x.base(),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(first),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(last)
);
}
void remove(BOOST_DEDUCED_TYPENAME ::boost::call_traits<
BOOST_DEDUCED_TYPENAME base_::value_type >::param_type value)
{
this->base().remove(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_to_base>()(value)
);
}
template<typename Predicate>
void remove_if(Predicate pred)
{
this->base().remove_if(
::boost::bimaps::container_adaptor::detail::unary_check_adaptor
<
Predicate,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( pred, this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>() )
);
}
void unique()
{
this->base().unique(
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
std::equal_to<BOOST_DEDUCED_TYPENAME base_::value_type>,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>(
std::equal_to<BOOST_DEDUCED_TYPENAME base_::value_type>(),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>()
)
);
}
template< class BinaryPredicate >
void unique(BinaryPredicate binary_pred)
{
this->base().unique(
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
BinaryPredicate,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( binary_pred,
this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>()
)
);
}
void merge(vector_set_view & x)
{
this->base().merge(x.base(),
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
std::less<BOOST_DEDUCED_TYPENAME base_::value_type>,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>(
std::less<BOOST_DEDUCED_TYPENAME base_::value_type>(),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>()
)
);
}
template< class Compare >
void merge(vector_set_view & x, Compare comp)
{
this->base().merge(x.base(),
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
Compare,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( comp, this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>() )
);
}
void sort()
{
this->base().sort(
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
std::less<BOOST_DEDUCED_TYPENAME base_::value_type>,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>(
std::less<BOOST_DEDUCED_TYPENAME base_::value_type>(),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>()
)
);
}
template< class Compare >
void sort(Compare comp)
{
this->base().sort(
::boost::bimaps::container_adaptor::detail::comparison_adaptor
<
Compare,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( comp, this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>() )
);
}
void reverse()
{
this->base().reverse();
}
// Rearrange Operations
void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
BOOST_DEDUCED_TYPENAME base_::iterator i)
{
this->base().relocate(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(i)
);
}
void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
BOOST_DEDUCED_TYPENAME base_::iterator first,
BOOST_DEDUCED_TYPENAME base_::iterator last)
{
this->base().relocate(
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(first),
this->template functor<
BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(last)
);
}
};
} // namespace views
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_VECTOR_SET_VIEW_HPP