]>
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/value_type_of.hpp | |
10 | /// \brief Consistent way to access the value type of a tagged or untagged type. | |
11 | ||
12 | #ifndef BOOST_BIMAP_TAGS_SUPPORT_VALUE_TYPE_OF_HPP | |
13 | #define BOOST_BIMAP_TAGS_SUPPORT_VALUE_TYPE_OF_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 | ||
23 | /** \struct boost::bimaps::tags::support::value_type_of | |
24 | \brief Metafunction to work with tagged and untagged type uniformly | |
25 | ||
26 | \code | |
27 | template< class Type > | |
28 | struct value_type_of | |
29 | { | |
30 | typedef {UntaggedType} type; | |
31 | }; | |
32 | \endcode | |
33 | ||
34 | If the type is tagged this metafunction returns Type::value_type, and if it is not | |
35 | tagged it return the same type. This allows to work consistenly with tagged and | |
36 | untagged types. | |
37 | ||
38 | See also tagged, tag_of. | |
39 | **/ | |
40 | ||
41 | #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES | |
42 | ||
43 | ||
44 | namespace boost { | |
45 | namespace bimaps { | |
46 | namespace tags { | |
47 | namespace support { | |
48 | ||
49 | ||
50 | // value_type_of metafunction | |
51 | ||
52 | template< class Type > | |
53 | struct value_type_of | |
54 | { | |
55 | typedef Type type; | |
56 | }; | |
57 | ||
58 | template< class Type, class Tag > | |
59 | struct value_type_of< tagged< Type, Tag > > | |
60 | { | |
61 | typedef Type type; | |
62 | }; | |
63 | ||
64 | ||
65 | } // namespace support | |
66 | } // namespace tags | |
67 | } // namespace bimaps | |
68 | } // namespace boost | |
69 | ||
70 | #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES | |
71 | ||
72 | #endif // BOOST_BIMAP_TAGS_SUPPORT_VALUE_TYPE_OF_HPP | |
73 | ||
74 |