fix doc example typo
[boost.git] / boost / fusion / container / map / detail / map_lookup.hpp
blob2f792cbdfd1e444a16e2a682956e70540c4f17ad
1 /*=============================================================================
2 Copyright (c) 2001-2006 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #ifndef BOOST_PP_IS_ITERATING
8 #if !defined(FUSION_MAP_LOOKUP_07212005_1118)
9 #define FUSION_MAP_LOOKUP_07212005_1118
11 #include <boost/preprocessor/iterate.hpp>
12 #include <boost/preprocessor/cat.hpp>
13 #include <boost/preprocessor/arithmetic/dec.hpp>
14 #include <boost/preprocessor/repetition/enum_params.hpp>
15 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
17 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
18 #pragma warning (push)
19 #pragma warning(disable: 4348) // redefinition of default parameter
20 #endif
22 template <typename Key, typename dummy = int>
23 struct meta_at_impl
25 typedef void_ type;
28 template <typename Key, typename dummy = int>
29 struct meta_find_impl
31 typedef vector_iterator<storage_type, storage_type::size::value> type;
34 template <typename Key, typename dummy = int>
35 struct meta_find_impl_const
37 typedef vector_iterator<storage_type const, storage_type::size::value> type;
40 template <typename Key>
41 vector_iterator<storage_type const, storage_type::size::value>
42 find_impl(mpl::identity<Key>) const
44 return vector_iterator<storage_type const, storage_type::size::value>(data);
47 template <typename Key>
48 vector_iterator<storage_type, storage_type::size::value>
49 find_impl(mpl::identity<Key>)
51 return vector_iterator<storage_type, storage_type::size::value>(data);
54 #define BOOST_PP_FILENAME_1 \
55 <boost/fusion/container/map/detail/map_lookup.hpp>
56 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_DEC(FUSION_MAX_MAP_SIZE))
57 #include BOOST_PP_ITERATE()
59 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
60 #pragma warning (pop)
61 #endif
63 #endif
64 #else // defined(BOOST_PP_IS_ITERATING)
65 ///////////////////////////////////////////////////////////////////////////////
67 // Preprocessor vertical repetition code
69 ///////////////////////////////////////////////////////////////////////////////
71 #define N BOOST_PP_ITERATION()
73 template <typename dummy>
74 struct meta_at_impl<
75 typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type, dummy>
77 typedef typename detail::map_value_type<BOOST_PP_CAT(T, N)>::type type;
80 typename detail::map_data_type<BOOST_PP_CAT(T, N)>::type
81 at_impl(mpl::identity<typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type>)
83 return detail::map_lookup_key<
85 , typename detail::map_data_type<BOOST_PP_CAT(T, N)>::type
86 , typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type
87 , storage_type>::call(data);
90 typename detail::map_const_data_type<BOOST_PP_CAT(T, N)>::type
91 at_impl(mpl::identity<typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type>) const
93 return detail::map_lookup_key<
95 , typename detail::map_const_data_type<BOOST_PP_CAT(T, N)>::type
96 , typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type
97 , storage_type const>::call(data);
100 template <typename dummy>
101 struct meta_find_impl<
102 typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type, dummy>
104 typedef vector_iterator<storage_type, N> type;
107 template <typename dummy>
108 struct meta_find_impl_const<
109 typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type, dummy>
111 typedef vector_iterator<storage_type const, N> type;
114 vector_iterator<storage_type, N>
115 find_impl(mpl::identity<typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type>)
117 return vector_iterator<storage_type, N>(data);
120 vector_iterator<storage_type const, N>
121 find_impl(mpl::identity<typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type>) const
123 return vector_iterator<storage_type const, N>(data);
126 #undef N
127 #endif // defined(BOOST_PP_IS_ITERATING)