Chris@16: // Boost.Bimap Chris@16: // Chris@16: // Copyright (c) 2006-2007 Matias Capeletto Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: /// \file list_of.hpp Chris@16: /// \brief Include support for list constrains for the bimap container Chris@16: Chris@16: #ifndef BOOST_BIMAP_LIST_OF_HPP Chris@16: #define BOOST_BIMAP_LIST_OF_HPP Chris@16: Chris@101: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace bimaps { Chris@16: Chris@16: Chris@16: /// \brief Set Type Specification Chris@16: /** Chris@16: This struct is used to specify a set specification. Chris@16: It is not a container, it is just a metaprogramming facility to Chris@16: express the type of a set. Generally, this specification will Chris@16: be used in other place to create a container. Chris@16: It has the same syntax that an std::list instantiation, except Chris@16: that the allocator cannot be specified. The rationale behind Chris@16: this difference is that the allocator is not part of the set Chris@16: type specification, rather it is a container configuration Chris@16: parameter. Chris@16: Chris@16: \code Chris@16: using namespace support; Chris@16: Chris@16: BOOST_STATIC_ASSERT( is_set_type_of< list_of >::value ) Chris@16: Chris@16: BOOST_STATIC_ASSERT Chris@16: ( Chris@16: is_same Chris@16: < Chris@16: list_of::index_bind Chris@16: < Chris@16: KeyExtractor, Chris@16: Tag Chris@16: Chris@16: >::type, Chris@16: Chris@16: sequenced< tag, KeyExtractor > Chris@16: Chris@16: >::value Chris@16: ) Chris@16: Chris@16: typedef bimap Chris@16: < Chris@16: list_of, RightKeyType Chris@16: Chris@16: > bimap_with_left_type_as_list; Chris@16: Chris@16: BOOST_STATIC_ASSERT Chris@16: ( Chris@16: is_same Chris@16: < Chris@16: list_of::map_view_bind Chris@16: < Chris@16: member_at::left, Chris@16: bimap_with_left_type_as_list Chris@16: Chris@16: >::type, Chris@16: list_map_view< member_at::left, bimap_with_left_type_as_list > Chris@16: Chris@16: >::value Chris@16: ) Chris@16: Chris@16: \endcode Chris@16: Chris@16: See also list_of_relation. Chris@16: **/ Chris@16: Chris@16: template< class Type > Chris@16: struct list_of : public ::boost::bimaps::detail::set_type_of_tag Chris@16: { Chris@16: /// User type, can be tagged Chris@16: typedef Type user_type; Chris@16: Chris@16: /// Type of the object that will be stored in the list Chris@16: typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::tags::support:: Chris@16: value_type_of::type value_type; Chris@16: Chris@16: Chris@16: struct lazy_concept_checked Chris@16: { Chris@16: BOOST_CLASS_REQUIRE ( value_type, Chris@16: boost, AssignableConcept ); Chris@16: Chris@16: typedef list_of type; Chris@16: }; Chris@16: Chris@16: BOOST_BIMAP_GENERATE_INDEX_BINDER_0CP_NO_EXTRACTOR( Chris@16: Chris@16: // binds to Chris@16: multi_index::sequenced Chris@16: ) Chris@16: Chris@16: BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER( Chris@16: Chris@16: // binds to Chris@16: views::list_map_view Chris@16: ) Chris@16: Chris@16: BOOST_BIMAP_GENERATE_SET_VIEW_BINDER( Chris@16: Chris@16: // binds to Chris@16: views::list_set_view Chris@16: ) Chris@16: Chris@16: typedef mpl::bool_ mutable_key; Chris@16: }; Chris@16: Chris@16: Chris@16: /// \brief List Of Relation Specification Chris@16: /** Chris@16: This struct is similar to list_of but it is bind logically to a Chris@16: relation. It is used in the bimap instantiation to specify the Chris@16: desired type of the main view. This struct implements internally Chris@16: a metafunction named bind_to that manages the quite complicated Chris@16: task of finding the right type of the set for the relation. Chris@16: Chris@16: \code Chris@16: template Chris@16: struct bind_to Chris@16: { Chris@16: typedef -unspecified- type; Chris@16: }; Chris@16: \endcode Chris@16: Chris@16: See also list_of, is_set_type_of_relation. Chris@16: **/ Chris@16: Chris@16: struct list_of_relation : public ::boost::bimaps::detail::set_type_of_relation_tag Chris@16: { Chris@16: BOOST_BIMAP_GENERATE_RELATION_BINDER_0CP( Chris@16: Chris@16: // binds to Chris@16: list_of Chris@16: ) Chris@16: Chris@16: typedef mpl::bool_ left_mutable_key; Chris@16: typedef mpl::bool_ right_mutable_key; Chris@16: }; Chris@16: Chris@16: Chris@16: } // namespace bimaps Chris@16: } // namespace boost Chris@16: Chris@16: Chris@16: #endif // BOOST_BIMAP_LIST_OF_HPP Chris@16: