File indexing completed on 2025-01-18 09:30:52
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_FLYWEIGHT_FLYWEIGHT_FWD_HPP
0010 #define BOOST_FLYWEIGHT_FLYWEIGHT_FWD_HPP
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
0017 #include <boost/detail/templated_streams.hpp>
0018 #include <boost/detail/workaround.hpp>
0019 #include <boost/parameter/parameters.hpp>
0020 #include <boost/preprocessor/punctuation/comma.hpp>
0021 #include <iosfwd>
0022
0023 #if !defined(BOOST_FLYWEIGHT_DISABLE_HASH_SUPPORT)
0024 #include <boost/functional/hash_fwd.hpp>
0025 #include <cstddef>
0026 #endif
0027
0028 namespace boost{
0029
0030 namespace flyweights{
0031
0032 template<
0033 typename T,
0034 typename Arg1=parameter::void_,
0035 typename Arg2=parameter::void_,
0036 typename Arg3=parameter::void_,
0037 typename Arg4=parameter::void_,
0038 typename Arg5=parameter::void_
0039 >
0040 class flyweight;
0041
0042 #define BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(n) \
0043 typename Arg##n##1,typename Arg##n##2,typename Arg##n##3, \
0044 typename Arg##n##4,typename Arg##n##5
0045 #define BOOST_FLYWEIGHT_TEMPL_ARGS(n) \
0046 Arg##n##1,Arg##n##2,Arg##n##3,Arg##n##4,Arg##n##5
0047
0048 template<
0049 typename T1,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
0050 typename T2,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
0051 >
0052 bool operator==(
0053 const flyweight<T1,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x,
0054 const flyweight<T2,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y);
0055
0056 template<
0057 typename T1,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
0058 typename T2,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
0059 >
0060 bool operator<(
0061 const flyweight<T1,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x,
0062 const flyweight<T2,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y);
0063
0064 #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
0065 template<
0066 typename T1,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
0067 typename T2
0068 >
0069 bool operator==(
0070 const flyweight<T1,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x,const T2& y);
0071
0072 template<
0073 typename T1,
0074 typename T2,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
0075 >
0076 bool operator==(
0077 const T1& x,const flyweight<T2,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y);
0078
0079 template<
0080 typename T1,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
0081 typename T2
0082 >
0083 bool operator<(
0084 const flyweight<T1,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x,const T2& y);
0085
0086 template<
0087 typename T1,
0088 typename T2,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
0089 >
0090 bool operator<(
0091 const T1& x,const flyweight<T2,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y);
0092 #endif
0093
0094 #define BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL(t,a1,a2) \
0095 template<t> \
0096 inline bool operator!=(const a1& x,const a2& y); \
0097 \
0098 template<t> \
0099 inline bool operator>(const a1& x,const a2& y); \
0100 \
0101 template<t> \
0102 inline bool operator>=(const a1& x,const a2& y); \
0103 \
0104 template<t> \
0105 inline bool operator<=(const a1& x,const a2& y); \
0106
0107 BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL(
0108 typename T1 BOOST_PP_COMMA()
0109 BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1) BOOST_PP_COMMA()
0110 typename T2 BOOST_PP_COMMA()
0111 BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2),
0112 flyweight<
0113 T1 BOOST_PP_COMMA() BOOST_FLYWEIGHT_TEMPL_ARGS(1)
0114 >,
0115 flyweight<
0116 T2 BOOST_PP_COMMA() BOOST_FLYWEIGHT_TEMPL_ARGS(2)
0117 >)
0118
0119 #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
0120 BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL(
0121 typename T1 BOOST_PP_COMMA()
0122 BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1) BOOST_PP_COMMA()
0123 typename T2,
0124 flyweight<
0125 T1 BOOST_PP_COMMA() BOOST_FLYWEIGHT_TEMPL_ARGS(1)
0126 >,
0127 T2)
0128
0129 BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL(
0130 typename T1 BOOST_PP_COMMA()
0131 typename T2 BOOST_PP_COMMA()
0132 BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2),
0133 T1,
0134 flyweight<
0135 T2 BOOST_PP_COMMA() BOOST_FLYWEIGHT_TEMPL_ARGS(2)
0136 >)
0137 #endif
0138
0139 template<typename T,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_)>
0140 inline void swap(
0141 flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)>& x,
0142 flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)>& y);
0143
0144 template<
0145 BOOST_TEMPLATED_STREAM_ARGS(ElemType,Traits)
0146 BOOST_TEMPLATED_STREAM_COMMA
0147 typename T,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_)
0148 >
0149 inline BOOST_TEMPLATED_STREAM(ostream,ElemType,Traits)& operator<<(
0150 BOOST_TEMPLATED_STREAM(ostream,ElemType,Traits)& out,
0151 const flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)>& x);
0152
0153 template<
0154 BOOST_TEMPLATED_STREAM_ARGS(ElemType,Traits)
0155 BOOST_TEMPLATED_STREAM_COMMA
0156 typename T,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_)
0157 >
0158 inline BOOST_TEMPLATED_STREAM(istream,ElemType,Traits)& operator>>(
0159 BOOST_TEMPLATED_STREAM(istream,ElemType,Traits)& in,
0160 flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)>& x);
0161
0162 }
0163
0164 using flyweights::flyweight;
0165
0166 }
0167
0168 #if !defined(BOOST_FLYWEIGHT_DISABLE_HASH_SUPPORT)
0169 #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
0170
0171 #if BOOST_WORKAROUND(_CPPLIB_VER,==520)
0172
0173 #define BOOST_FLYWEIGHT_STD_HASH_STRUCT_KEYWORD class
0174 #else
0175 #define BOOST_FLYWEIGHT_STD_HASH_STRUCT_KEYWORD struct
0176 #endif
0177
0178 #if !defined(_LIBCPP_VERSION)
0179 namespace std{
0180 template <class T> BOOST_FLYWEIGHT_STD_HASH_STRUCT_KEYWORD hash;
0181 }
0182 #else
0183
0184 #include <functional>
0185 #endif
0186
0187 namespace std{
0188
0189 template<typename T,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_)>
0190 BOOST_FLYWEIGHT_STD_HASH_STRUCT_KEYWORD
0191 hash<boost::flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)> >;
0192
0193 }
0194 #endif
0195
0196 namespace boost{
0197 #if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
0198 namespace flyweights{
0199 #endif
0200
0201 template<typename T,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_)>
0202 inline std::size_t hash_value(
0203 const flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)>& x);
0204
0205 #if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
0206 }
0207 #endif
0208 }
0209 #endif
0210
0211 #undef BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL
0212 #undef BOOST_FLYWEIGHT_TEMPL_ARGS
0213 #undef BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS
0214
0215 #endif