]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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) | |
8 | ||
9 | /// \file tags/support/apply_to_value_type.hpp | |
10 | /// \brief Similar to mpl::apply but for tagged types. | |
11 | ||
12 | #ifndef BOOST_BIMAP_TAGS_SUPPORT_APPLY_TO_VALUE_TYPE_HPP | |
13 | #define BOOST_BIMAP_TAGS_SUPPORT_APPLY_TO_VALUE_TYPE_HPP | |
14 | ||
15 | #if defined(_MSC_VER) | |
16 | #pragma once | |
17 | #endif | |
18 | ||
19 | #include <boost/config.hpp> | |
20 | ||
21 | #include <boost/bimap/tags/tagged.hpp> | |
22 | #include <boost/mpl/apply.hpp> | |
23 | ||
24 | /** \struct boost::bimaps::tags::support::apply_to_value_type | |
25 | \brief Higger order metafunction similar to mpl::apply but for tagged types. | |
26 | ||
27 | \code | |
28 | template< class Metafunction, class TaggedType > | |
29 | struct apply_to_value_type | |
30 | { | |
31 | typedef tagged | |
32 | < | |
33 | Metafuntion< value_type_of< TaggedType >::type >::type, | |
34 | tag_of< TaggedType >::type | |
35 | ||
36 | > type; | |
37 | }; | |
38 | \endcode | |
39 | ||
40 | This higher order metafunctions is very useful, and it can be used with lambda | |
41 | expresions. | |
42 | ||
43 | See also tagged. | |
44 | **/ | |
45 | ||
46 | #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES | |
47 | ||
48 | namespace boost { | |
49 | namespace bimaps { | |
50 | namespace tags { | |
51 | namespace support { | |
52 | ||
53 | template < class F, class TaggedType > | |
54 | struct apply_to_value_type; | |
55 | ||
56 | template < class F, class ValueType, class Tag > | |
57 | struct apply_to_value_type<F, tagged<ValueType,Tag> > | |
58 | { | |
59 | typedef BOOST_DEDUCED_TYPENAME mpl::apply< F, ValueType >::type new_value_type; | |
60 | typedef tagged< new_value_type, Tag > type; | |
61 | }; | |
62 | ||
63 | } // namespace support | |
64 | } // namespace tags | |
65 | } // namespace bimaps | |
66 | } // namespace boost | |
67 | ||
68 | #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES | |
69 | ||
70 | #endif // BOOST_BIMAP_TAGS_SUPPORT_APPLY_TO_VALUE_TYPE_HPP |