fix doc example typo
[boost.git] / boost / bimap / unconstrained_set_of.hpp
blob0fcf94697afb12caed71c937cc378432e4ffa10f
1 // Boost.Bimap
2 //
3 // Copyright (c) 2006-2007 Matias Capeletto
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 /// \file unconstrained_set_of.hpp
10 /// \brief Include support for set constrains for the bimap container
12 #ifndef BOOST_BIMAP_UNCONSTRAINED_SET_OF_HPP
13 #define BOOST_BIMAP_UNCONSTRAINED_SET_OF_HPP
15 #if defined(_MSC_VER) && (_MSC_VER>=1200)
16 #pragma once
17 #endif
19 #include <boost/config.hpp>
21 #include <boost/bimap/detail/user_interface_config.hpp>
23 #include <boost/mpl/bool.hpp>
25 #include <boost/concept_check.hpp>
27 #include <boost/bimap/detail/concept_tags.hpp>
29 #include <boost/bimap/tags/support/value_type_of.hpp>
31 #include <boost/bimap/detail/generate_index_binder.hpp>
32 #include <boost/bimap/detail/generate_view_binder.hpp>
33 #include <boost/bimap/detail/generate_relation_binder.hpp>
35 #include <boost/bimap/views/unconstrained_map_view.hpp>
36 #include <boost/bimap/views/unconstrained_set_view.hpp>
38 namespace boost {
39 namespace bimaps {
41 /// \brief Set Type Specification
42 /**
43 This struct is used to specify a set specification.
44 It is not a container, it is just a metaprogramming facility to
45 express the type of a set. Generally, this specification will
46 be used in other place to create a container.
47 The first parameter is the type of the objects in the set.
49 \code
51 using namespace support;
53 BOOST_STATIC_ASSERT( is_set_type_of< unconstrained_set_of<Type> >::value )
55 \endcode
57 See also unconstrained_set_of_relation.
58 **/
60 template
62 class KeyType
64 struct unconstrained_set_of : public ::boost::bimaps::detail::set_type_of_tag
66 /// User type, can be tagged
67 typedef KeyType user_type;
69 /// Type of the object that will be stored in the container
70 typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::tags::support::
71 value_type_of<user_type>::type value_type;
73 struct lazy_concept_checked
75 BOOST_CLASS_REQUIRE ( value_type,
76 boost, AssignableConcept );
78 typedef unconstrained_set_of type;
81 BOOST_BIMAP_GENERATE_INDEX_BINDER_FAKE
83 BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
85 // binds to
86 views::unconstrained_map_view
89 BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
91 // binds to
92 views::unconstrained_set_view
95 typedef mpl::bool_<true> mutable_key;
98 /// \brief Set Of Relation Specification
99 /**
100 This struct is similar to unconstrained_set_of but it is bind
101 logically to a relation. It is used in the bimap instantiation to
102 specify the desired type of the main view.
104 See also unconstrained_set_of, is_set_type_of_relation.
107 struct unconstrained_set_of_relation : public ::boost::bimaps::detail::set_type_of_relation_tag
110 BOOST_BIMAP_GENERATE_RELATION_BINDER_0CP(
112 // binds to
113 unconstrained_set_of
116 typedef mpl::bool_<true> left_mutable_key;
117 typedef mpl::bool_<true> right_mutable_key;
120 #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
122 namespace detail {
124 template<class T>
125 struct is_unconstrained_set_of :
126 ::boost::mpl::false_ {};
128 template<class T>
129 struct is_unconstrained_set_of< unconstrained_set_of<T> > :
130 ::boost::mpl::true_ {};
132 } // namespace detail
134 #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
136 } // namespace bimaps
137 } // namespace boost
140 /** \struct boost::bimaps::detail::is_unconstrained_set_of
141 \brief Trait to check if a type is unconstrained_set_of.
142 \code
143 template< class T >
144 struct is_unconstrained_set_of;
145 \endcode
149 #endif // BOOST_BIMAP_UNCONSTRAINED_SET_OF_HPP