1 /* Copyright 2006-2008 Joaquin M Lopez Munoz.
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * http://www.boost.org/LICENSE_1_0.txt)
6 * See http://www.boost.org/libs/flyweight for library home page.
9 #ifndef BOOST_FLYWEIGHT_FLYWEIGHT_FWD_HPP
10 #define BOOST_FLYWEIGHT_FLYWEIGHT_FWD_HPP
12 #if defined(_MSC_VER)&&(_MSC_VER>=1200)
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17 #include <boost/detail/templated_streams.hpp>
18 #include <boost/parameter/parameters.hpp>
19 #include <boost/preprocessor/punctuation/comma.hpp>
28 typename Arg1
=parameter::void_
,
29 typename Arg2
=parameter::void_
,
30 typename Arg3
=parameter::void_
,
31 typename Arg4
=parameter::void_
,
32 typename Arg5
=parameter::void_
36 #define BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(n) \
37 typename Arg##n##1,typename Arg##n##2,typename Arg##n##3, \
38 typename Arg##n##4,typename Arg##n##5
39 #define BOOST_FLYWEIGHT_TEMPL_ARGS(n) \
40 Arg##n##1,Arg##n##2,Arg##n##3,Arg##n##4,Arg##n##5
43 typename T1
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
44 typename T2
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
47 const flyweight
<T1
,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x
,
48 const flyweight
<T2
,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y
);
51 typename T1
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
52 typename T2
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
55 const flyweight
<T1
,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x
,
56 const flyweight
<T2
,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y
);
58 #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
60 typename T1
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
64 const flyweight
<T1
,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x
,const T2
& y
);
68 typename T2
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
71 const T1
& x
,const flyweight
<T2
,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y
);
74 typename T1
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
78 const flyweight
<T1
,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x
,const T2
& y
);
82 typename T2
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
85 const T1
& x
,const flyweight
<T2
,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y
);
86 #endif /* !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) */
88 #define BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL(t,a1,a2) \
90 inline bool operator!=(const a1& x,const a2& y); \
93 inline bool operator>(const a1& x,const a2& y); \
96 inline bool operator>=(const a1& x,const a2& y); \
99 inline bool operator<=(const a1& x,const a2& y); \
101 BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL(
102 typename T1
BOOST_PP_COMMA()
103 BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1) BOOST_PP_COMMA()
104 typename T2
BOOST_PP_COMMA()
105 BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2),
107 T1
BOOST_PP_COMMA() BOOST_FLYWEIGHT_TEMPL_ARGS(1)
110 T2
BOOST_PP_COMMA() BOOST_FLYWEIGHT_TEMPL_ARGS(2)
113 #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
114 BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL(
115 typename T1
BOOST_PP_COMMA()
116 BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1) BOOST_PP_COMMA()
119 T1
BOOST_PP_COMMA() BOOST_FLYWEIGHT_TEMPL_ARGS(1)
123 BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL(
124 typename T1
BOOST_PP_COMMA()
125 typename T2
BOOST_PP_COMMA()
126 BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2),
129 T2
BOOST_PP_COMMA() BOOST_FLYWEIGHT_TEMPL_ARGS(2)
131 #endif /* !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) */
133 template<typename T
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_
)>
135 flyweight
<T
,BOOST_FLYWEIGHT_TEMPL_ARGS(_
)>& x
,
136 flyweight
<T
,BOOST_FLYWEIGHT_TEMPL_ARGS(_
)>& y
);
139 BOOST_TEMPLATED_STREAM_ARGS(ElemType
,Traits
)
140 BOOST_TEMPLATED_STREAM_COMMA
141 typename T
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_
)
143 inline BOOST_TEMPLATED_STREAM(ostream
,ElemType
,Traits
)& operator<<(
144 BOOST_TEMPLATED_STREAM(ostream
,ElemType
,Traits
)& out
,
145 const flyweight
<T
,BOOST_FLYWEIGHT_TEMPL_ARGS(_
)>& x
);
148 BOOST_TEMPLATED_STREAM_ARGS(ElemType
,Traits
)
149 BOOST_TEMPLATED_STREAM_COMMA
150 typename T
,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_
)
152 inline BOOST_TEMPLATED_STREAM(istream
,ElemType
,Traits
)& operator>>(
153 BOOST_TEMPLATED_STREAM(istream
,ElemType
,Traits
)& in
,
154 flyweight
<T
,BOOST_FLYWEIGHT_TEMPL_ARGS(_
)>& x
);
156 } /* namespace flyweights */
158 using flyweights::flyweight
;
160 } /* namespace boost */
162 #undef BOOST_FLYWEIGHT_COMPLETE_COMP_OPS_DECL
163 #undef BOOST_FLYWEIGHT_TEMPL_ARGS
164 #undef BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS