]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/bimap/include/boost/bimap/tags/support/tag_of.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / bimap / include / boost / bimap / tags / support / tag_of.hpp
CommitLineData
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/tag_of.hpp
10/// \brief Safe way to acces the tag of a type
11
12#ifndef BOOST_BIMAP_TAGS_SUPPORT_TAG_OF_HPP
13#define BOOST_BIMAP_TAGS_SUPPORT_TAG_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#include <boost/bimap/detail/debug/static_error.hpp>
23
24/** \struct boost::bimaps::tags::support::tag_of
25\brief Metafunction to obtain the tag of a type.
26
27\code
28template< class TaggedType >
29struct tag_of
30{
31 typedef {Tag} type;
32};
33\endcode
34
35If the type is not tagged you will get a compile timer error with the following message:
36
37\verbatim
38USING_TAG_OF_WITH_AN_UNTAGGED_TYPE, TaggedType
39\endverbatim
40
41See also tagged, value_type_of.
42 **/
43
44#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
45
46namespace boost {
47namespace bimaps {
48namespace tags {
49namespace support {
50
51
52// tag_of metafunction
53
54template< class Type >
55struct tag_of
56{
57 BOOST_BIMAP_STATIC_ERROR( USING_TAG_OF_WITH_AN_UNTAGGED_TYPE, (Type) );
58};
59
60template< class Type, class Tag >
61struct tag_of< tagged< Type, Tag > >
62{
63 typedef Tag type;
64};
65
66
67} // namespace support
68} // namespace tags
69} // namespace bimaps
70} // namespace boost
71
72#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
73
74#endif // BOOST_BIMAP_TAGS_SUPPORT_TAG_OF_HPP
75