fix doc example typo
[boost.git] / boost / function_types / property_tags.hpp
blobbbc64d53a3650be7f6aee135c4b0ab27cb6964d2
2 // (C) Copyright Tobias Schwinger
3 //
4 // Use modification and distribution are subject to the boost Software License,
5 // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
7 //------------------------------------------------------------------------------
9 #ifndef BOOST_FT_DETAIL_TAGS_HPP_INCLUDED
10 #define BOOST_FT_DETAIL_TAGS_HPP_INCLUDED
12 #include <cstddef>
14 #include <boost/type_traits/integral_constant.hpp>
15 #include <boost/mpl/bitxor.hpp>
18 namespace boost { namespace function_types {
20 namespace detail
22 typedef long bits_t;
24 template<bits_t Value> struct constant
25 : boost::integral_constant<bits_t,Value>
26 { };
28 template<bits_t Bits, bits_t Mask> struct property_tag
30 typedef constant<Bits> bits;
31 typedef constant<Mask> mask;
34 template<typename T> struct bits : T::bits { };
35 template<typename T> struct mask : T::mask { };
37 // forward declaration, defined in pp_tags
38 template<bits_t Bits, bits_t CCID> struct encode_bits_impl;
40 // forward declaration, defined in pp_tags
41 template<bits_t LHS_bits, bits_t LHS_mask,
42 bits_t RHS_bits, bits_t RHS_mask>
43 struct tag_ice;
45 // forward declaration, defined in retag_default_cc
46 template<class Tag, class RegTag = Tag> struct retag_default_cc;
48 template<bits_t Bits, bits_t CCID> struct encode_bits
49 : constant<
50 ::boost::function_types::detail::encode_bits_impl<Bits,CCID>::value
52 { };
54 template<class LHS, class RHS> struct compound_tag
56 typedef constant<
57 ::boost::function_types::detail::tag_ice
58 < ::boost::function_types::detail::bits<LHS>::value
59 , ::boost::function_types::detail::mask<LHS>::value
60 , ::boost::function_types::detail::bits<RHS>::value
61 , ::boost::function_types::detail::mask<RHS>::value
62 >::combined_bits
63 > bits;
65 typedef constant<
66 ::boost::function_types::detail::tag_ice
67 < ::boost::function_types::detail::bits<LHS>::value
68 , ::boost::function_types::detail::mask<LHS>::value
69 , ::boost::function_types::detail::bits<RHS>::value
70 , ::boost::function_types::detail::mask<RHS>::value
71 >::combined_mask
72 > mask;
75 template <class Base, class PropOld, class PropNew>
76 struct changed_tag
77 : Base
79 typedef mpl::bitxor_
80 <typename Base::bits, typename PropOld::bits, typename PropNew::bits>
81 bits;
84 template<class Tag, class QueryTag> struct represents_impl
85 : boost::integral_constant<bool,
86 ::boost::function_types::detail::tag_ice
87 < ::boost::function_types::detail::bits<Tag>::value
88 , ::boost::function_types::detail::mask<Tag>::value
89 , ::boost::function_types::detail::bits<QueryTag>::value
90 , ::boost::function_types::detail::mask<QueryTag>::value
91 >::match
93 { };
95 } // namespace detail
97 typedef detail::property_tag<0,0> null_tag;
99 template<class Tag1, class Tag2, class Tag3 = null_tag, class Tag4 = null_tag>
100 struct tag
101 : detail::compound_tag< detail::compound_tag<Tag1,Tag2>,
102 detail::compound_tag<Tag3,Tag4> >
103 { };
105 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
106 template<class Tag1, class Tag2, class Tag3> struct tag<Tag1,Tag2,Tag3,null_tag>
107 : detail::compound_tag<detail::compound_tag<Tag1,Tag2>,Tag3>
108 { };
109 template<class Tag1, class Tag2> struct tag<Tag1,Tag2,null_tag,null_tag>
110 : detail::compound_tag<Tag1,Tag2>
111 { };
112 template<class Tag1> struct tag<Tag1,null_tag,null_tag,null_tag>
113 : Tag1
114 { };
115 #endif
118 template<class Tag, class QueryTag> struct represents
119 : detail::represents_impl<Tag, detail::retag_default_cc<QueryTag,Tag> >
120 { };
123 template<class Tag, class QueryTag> struct extract
125 typedef detail::constant<
126 ::boost::function_types::detail::tag_ice
127 < ::boost::function_types::detail::bits<Tag>::value
128 , ::boost::function_types::detail::mask<Tag>::value
129 , ::boost::function_types::detail::bits<QueryTag>::value
130 , ::boost::function_types::detail::mask<QueryTag>::value
131 >::extracted_bits
132 > bits;
134 typedef detail::constant<
135 ::boost::function_types::detail::mask<QueryTag>::value
136 > mask;
139 } } // namespace ::boost::function_types
141 #include <boost/function_types/detail/pp_tags/preprocessed.hpp>
143 namespace boost { namespace function_types {
144 #define BOOST_FT_cc_file <boost/function_types/detail/pp_tags/cc_tag.hpp>
145 #include <boost/function_types/detail/pp_loop.hpp>
146 } } // namespace boost::function_types
148 #endif