fix doc example typo
[boost.git] / boost / flyweight / flyweight_fwd.hpp
blob6295a8dbfb0d072bc5c61cfb288bab9d6f084189
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.
7 */
9 #ifndef BOOST_FLYWEIGHT_FLYWEIGHT_FWD_HPP
10 #define BOOST_FLYWEIGHT_FLYWEIGHT_FWD_HPP
12 #if defined(_MSC_VER)&&(_MSC_VER>=1200)
13 #pragma once
14 #endif
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>
20 #include <iosfwd>
22 namespace boost{
24 namespace flyweights{
26 template<
27 typename T,
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_
34 class flyweight;
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
42 template<
43 typename T1,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
44 typename T2,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
46 bool operator==(
47 const flyweight<T1,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x,
48 const flyweight<T2,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y);
50 template<
51 typename T1,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
52 typename T2,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
54 bool operator<(
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)
59 template<
60 typename T1,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
61 typename T2
63 bool operator==(
64 const flyweight<T1,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x,const T2& y);
66 template<
67 typename T1,
68 typename T2,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
70 bool operator==(
71 const T1& x,const flyweight<T2,BOOST_FLYWEIGHT_TEMPL_ARGS(2)>& y);
73 template<
74 typename T1,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(1),
75 typename T2
77 bool operator<(
78 const flyweight<T1,BOOST_FLYWEIGHT_TEMPL_ARGS(1)>& x,const T2& y);
80 template<
81 typename T1,
82 typename T2,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(2)
84 bool operator<(
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) \
89 template<t> \
90 inline bool operator!=(const a1& x,const a2& y); \
92 template<t> \
93 inline bool operator>(const a1& x,const a2& y); \
95 template<t> \
96 inline bool operator>=(const a1& x,const a2& y); \
98 template<t> \
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),
106 flyweight<
107 T1 BOOST_PP_COMMA() BOOST_FLYWEIGHT_TEMPL_ARGS(1)
109 flyweight<
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()
117 typename T2,
118 flyweight<
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),
128 flyweight<
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(_)>
134 inline void swap(
135 flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)>& x,
136 flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)>& y);
138 template<
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);
147 template<
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
166 #endif