bind.hpp 80 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365
  1. #ifndef BOOST_BIND_BIND_HPP_INCLUDED
  2. #define BOOST_BIND_BIND_HPP_INCLUDED
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  5. # pragma once
  6. #endif
  7. //
  8. // bind.hpp - binds function objects to arguments
  9. //
  10. // Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
  11. // Copyright (c) 2001 David Abrahams
  12. // Copyright (c) 2005 Peter Dimov
  13. //
  14. // Distributed under the Boost Software License, Version 1.0. (See
  15. // accompanying file LICENSE_1_0.txt or copy at
  16. // http://www.boost.org/LICENSE_1_0.txt)
  17. //
  18. // See http://www.boost.org/libs/bind/bind.html for documentation.
  19. //
  20. #include <boost/config.hpp>
  21. #include <boost/ref.hpp>
  22. #include <boost/mem_fn.hpp>
  23. #include <boost/type.hpp>
  24. #include <boost/is_placeholder.hpp>
  25. #include <boost/bind/arg.hpp>
  26. #include <boost/detail/workaround.hpp>
  27. #include <boost/visit_each.hpp>
  28. #include <boost/core/enable_if.hpp>
  29. #include <boost/core/is_same.hpp>
  30. #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
  31. #include <utility> // std::forward
  32. #endif
  33. // Borland-specific bug, visit_each() silently fails to produce code
  34. #if defined(__BORLANDC__)
  35. # define BOOST_BIND_VISIT_EACH boost::visit_each
  36. #else
  37. # define BOOST_BIND_VISIT_EACH visit_each
  38. #endif
  39. #include <boost/bind/storage.hpp>
  40. #ifdef BOOST_MSVC
  41. # pragma warning(push)
  42. # pragma warning(disable: 4512) // assignment operator could not be generated
  43. #endif
  44. namespace boost
  45. {
  46. template<class T> class weak_ptr;
  47. namespace _bi // implementation details
  48. {
  49. // result_traits
  50. template<class R, class F> struct result_traits
  51. {
  52. typedef R type;
  53. };
  54. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
  55. struct unspecified {};
  56. template<class F> struct result_traits<unspecified, F>
  57. {
  58. typedef typename F::result_type type;
  59. };
  60. template<class F> struct result_traits< unspecified, reference_wrapper<F> >
  61. {
  62. typedef typename F::result_type type;
  63. };
  64. #endif
  65. // ref_compare
  66. template<class T> bool ref_compare( T const & a, T const & b, long )
  67. {
  68. return a == b;
  69. }
  70. template<int I> bool ref_compare( arg<I> const &, arg<I> const &, int )
  71. {
  72. return true;
  73. }
  74. template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) (), int )
  75. {
  76. return true;
  77. }
  78. template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b, int )
  79. {
  80. return a.get_pointer() == b.get_pointer();
  81. }
  82. // bind_t forward declaration for listN
  83. template<class R, class F, class L> class bind_t;
  84. template<class R, class F, class L> bool ref_compare( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
  85. {
  86. return a.compare( b );
  87. }
  88. // value
  89. template<class T> class value
  90. {
  91. public:
  92. value(T const & t): t_(t) {}
  93. T & get() { return t_; }
  94. T const & get() const { return t_; }
  95. bool operator==(value const & rhs) const
  96. {
  97. return t_ == rhs.t_;
  98. }
  99. private:
  100. T t_;
  101. };
  102. // ref_compare for weak_ptr
  103. template<class T> bool ref_compare( value< weak_ptr<T> > const & a, value< weak_ptr<T> > const & b, int )
  104. {
  105. return !(a.get() < b.get()) && !(b.get() < a.get());
  106. }
  107. // type
  108. template<class T> class type {};
  109. // unwrap
  110. template<class F> struct unwrapper
  111. {
  112. static inline F & unwrap( F & f, long )
  113. {
  114. return f;
  115. }
  116. template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int )
  117. {
  118. return rf.get();
  119. }
  120. template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int )
  121. {
  122. return _mfi::dm<R, T>( pm );
  123. }
  124. };
  125. // listN
  126. class list0
  127. {
  128. public:
  129. list0() {}
  130. template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
  131. template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
  132. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  133. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  134. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  135. template<class R, class F, class A> R operator()(type<R>, F & f, A &, long)
  136. {
  137. return unwrapper<F>::unwrap(f, 0)();
  138. }
  139. template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const
  140. {
  141. return unwrapper<F const>::unwrap(f, 0)();
  142. }
  143. template<class F, class A> void operator()(type<void>, F & f, A &, int)
  144. {
  145. unwrapper<F>::unwrap(f, 0)();
  146. }
  147. template<class F, class A> void operator()(type<void>, F const & f, A &, int) const
  148. {
  149. unwrapper<F const>::unwrap(f, 0)();
  150. }
  151. template<class V> void accept(V &) const
  152. {
  153. }
  154. bool operator==(list0 const &) const
  155. {
  156. return true;
  157. }
  158. };
  159. #ifdef BOOST_MSVC
  160. // MSVC is bright enough to realise that the parameter rhs
  161. // in operator==may be unused for some template argument types:
  162. #pragma warning(push)
  163. #pragma warning(disable:4100)
  164. #endif
  165. template< class A1 > class list1: private storage1< A1 >
  166. {
  167. private:
  168. typedef storage1< A1 > base_type;
  169. public:
  170. explicit list1( A1 a1 ): base_type( a1 ) {}
  171. A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
  172. A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
  173. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  174. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  175. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  176. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  177. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  178. template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
  179. {
  180. return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
  181. }
  182. template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
  183. {
  184. return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
  185. }
  186. template<class F, class A> void operator()(type<void>, F & f, A & a, int)
  187. {
  188. unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
  189. }
  190. template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
  191. {
  192. unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
  193. }
  194. template<class V> void accept(V & v) const
  195. {
  196. base_type::accept(v);
  197. }
  198. bool operator==(list1 const & rhs) const
  199. {
  200. return ref_compare(base_type::a1_, rhs.a1_, 0);
  201. }
  202. };
  203. struct logical_and;
  204. struct logical_or;
  205. template< class A1, class A2 > class list2: private storage2< A1, A2 >
  206. {
  207. private:
  208. typedef storage2< A1, A2 > base_type;
  209. public:
  210. list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {}
  211. A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
  212. A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
  213. A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
  214. A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
  215. template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
  216. template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
  217. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  218. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  219. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  220. template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
  221. {
  222. return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
  223. }
  224. template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
  225. {
  226. return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
  227. }
  228. template<class F, class A> void operator()(type<void>, F & f, A & a, int)
  229. {
  230. unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
  231. }
  232. template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
  233. {
  234. unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
  235. }
  236. template<class A> bool operator()( type<bool>, logical_and & /*f*/, A & a, int )
  237. {
  238. return a[ base_type::a1_ ] && a[ base_type::a2_ ];
  239. }
  240. template<class A> bool operator()( type<bool>, logical_and const & /*f*/, A & a, int ) const
  241. {
  242. return a[ base_type::a1_ ] && a[ base_type::a2_ ];
  243. }
  244. template<class A> bool operator()( type<bool>, logical_or & /*f*/, A & a, int )
  245. {
  246. return a[ base_type::a1_ ] || a[ base_type::a2_ ];
  247. }
  248. template<class A> bool operator()( type<bool>, logical_or const & /*f*/, A & a, int ) const
  249. {
  250. return a[ base_type::a1_ ] || a[ base_type::a2_ ];
  251. }
  252. template<class V> void accept(V & v) const
  253. {
  254. base_type::accept(v);
  255. }
  256. bool operator==(list2 const & rhs) const
  257. {
  258. return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0);
  259. }
  260. };
  261. template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 >
  262. {
  263. private:
  264. typedef storage3< A1, A2, A3 > base_type;
  265. public:
  266. list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {}
  267. A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
  268. A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
  269. A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
  270. A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
  271. A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
  272. A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
  273. template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
  274. template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
  275. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  276. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  277. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  278. template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
  279. {
  280. return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
  281. }
  282. template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
  283. {
  284. return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
  285. }
  286. template<class F, class A> void operator()(type<void>, F & f, A & a, int)
  287. {
  288. unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
  289. }
  290. template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
  291. {
  292. unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
  293. }
  294. template<class V> void accept(V & v) const
  295. {
  296. base_type::accept(v);
  297. }
  298. bool operator==(list3 const & rhs) const
  299. {
  300. return
  301. ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
  302. ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
  303. ref_compare( base_type::a3_, rhs.a3_, 0 );
  304. }
  305. };
  306. template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 >
  307. {
  308. private:
  309. typedef storage4< A1, A2, A3, A4 > base_type;
  310. public:
  311. list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {}
  312. A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
  313. A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
  314. A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
  315. A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
  316. A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
  317. A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
  318. A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
  319. A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
  320. template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
  321. template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
  322. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  323. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  324. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  325. template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
  326. {
  327. return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
  328. }
  329. template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
  330. {
  331. return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
  332. }
  333. template<class F, class A> void operator()(type<void>, F & f, A & a, int)
  334. {
  335. unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
  336. }
  337. template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
  338. {
  339. unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
  340. }
  341. template<class V> void accept(V & v) const
  342. {
  343. base_type::accept(v);
  344. }
  345. bool operator==(list4 const & rhs) const
  346. {
  347. return
  348. ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
  349. ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
  350. ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
  351. ref_compare( base_type::a4_, rhs.a4_, 0 );
  352. }
  353. };
  354. template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 >
  355. {
  356. private:
  357. typedef storage5< A1, A2, A3, A4, A5 > base_type;
  358. public:
  359. list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {}
  360. A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
  361. A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
  362. A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
  363. A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
  364. A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
  365. A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
  366. A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
  367. A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
  368. A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
  369. A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
  370. template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
  371. template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
  372. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  373. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  374. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  375. template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
  376. {
  377. return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
  378. }
  379. template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
  380. {
  381. return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
  382. }
  383. template<class F, class A> void operator()(type<void>, F & f, A & a, int)
  384. {
  385. unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
  386. }
  387. template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
  388. {
  389. unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
  390. }
  391. template<class V> void accept(V & v) const
  392. {
  393. base_type::accept(v);
  394. }
  395. bool operator==(list5 const & rhs) const
  396. {
  397. return
  398. ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
  399. ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
  400. ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
  401. ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
  402. ref_compare( base_type::a5_, rhs.a5_, 0 );
  403. }
  404. };
  405. template<class A1, class A2, class A3, class A4, class A5, class A6> class list6: private storage6< A1, A2, A3, A4, A5, A6 >
  406. {
  407. private:
  408. typedef storage6< A1, A2, A3, A4, A5, A6 > base_type;
  409. public:
  410. list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {}
  411. A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
  412. A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
  413. A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
  414. A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
  415. A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
  416. A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
  417. A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
  418. A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
  419. A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
  420. A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
  421. A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
  422. A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
  423. template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
  424. template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
  425. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  426. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  427. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  428. template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
  429. {
  430. return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
  431. }
  432. template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
  433. {
  434. return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
  435. }
  436. template<class F, class A> void operator()(type<void>, F & f, A & a, int)
  437. {
  438. unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
  439. }
  440. template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
  441. {
  442. unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
  443. }
  444. template<class V> void accept(V & v) const
  445. {
  446. base_type::accept(v);
  447. }
  448. bool operator==(list6 const & rhs) const
  449. {
  450. return
  451. ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
  452. ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
  453. ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
  454. ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
  455. ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
  456. ref_compare( base_type::a6_, rhs.a6_, 0 );
  457. }
  458. };
  459. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 >
  460. {
  461. private:
  462. typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type;
  463. public:
  464. list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {}
  465. A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
  466. A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
  467. A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
  468. A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
  469. A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
  470. A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
  471. A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
  472. A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
  473. A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
  474. A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
  475. A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
  476. A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
  477. A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
  478. A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
  479. template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
  480. template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
  481. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  482. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  483. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  484. template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
  485. {
  486. return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
  487. }
  488. template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
  489. {
  490. return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
  491. }
  492. template<class F, class A> void operator()(type<void>, F & f, A & a, int)
  493. {
  494. unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
  495. }
  496. template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
  497. {
  498. unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
  499. }
  500. template<class V> void accept(V & v) const
  501. {
  502. base_type::accept(v);
  503. }
  504. bool operator==(list7 const & rhs) const
  505. {
  506. return
  507. ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
  508. ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
  509. ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
  510. ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
  511. ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
  512. ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
  513. ref_compare( base_type::a7_, rhs.a7_, 0 );
  514. }
  515. };
  516. template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class list8: private storage8< A1, A2, A3, A4, A5, A6, A7, A8 >
  517. {
  518. private:
  519. typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type;
  520. public:
  521. list8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8 ) {}
  522. A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
  523. A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
  524. A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
  525. A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
  526. A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
  527. A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
  528. A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
  529. A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
  530. A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
  531. A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
  532. A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
  533. A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
  534. A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
  535. A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
  536. A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
  537. A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
  538. template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
  539. template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
  540. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  541. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  542. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  543. template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
  544. {
  545. return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
  546. }
  547. template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
  548. {
  549. return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
  550. }
  551. template<class F, class A> void operator()(type<void>, F & f, A & a, int)
  552. {
  553. unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
  554. }
  555. template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
  556. {
  557. unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
  558. }
  559. template<class V> void accept(V & v) const
  560. {
  561. base_type::accept(v);
  562. }
  563. bool operator==(list8 const & rhs) const
  564. {
  565. return
  566. ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
  567. ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
  568. ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
  569. ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
  570. ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
  571. ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
  572. ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
  573. ref_compare( base_type::a8_, rhs.a8_, 0 );
  574. }
  575. };
  576. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 >
  577. {
  578. private:
  579. typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type;
  580. public:
  581. list9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) {}
  582. A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
  583. A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
  584. A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
  585. A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
  586. A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
  587. A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
  588. A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
  589. A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
  590. A9 operator[] (boost::arg<9>) const { return base_type::a9_; }
  591. A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
  592. A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
  593. A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
  594. A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
  595. A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
  596. A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
  597. A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
  598. A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
  599. A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; }
  600. template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
  601. template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
  602. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  603. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
  604. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
  605. template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
  606. {
  607. return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
  608. }
  609. template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
  610. {
  611. return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
  612. }
  613. template<class F, class A> void operator()(type<void>, F & f, A & a, int)
  614. {
  615. unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
  616. }
  617. template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
  618. {
  619. unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
  620. }
  621. template<class V> void accept(V & v) const
  622. {
  623. base_type::accept(v);
  624. }
  625. bool operator==(list9 const & rhs) const
  626. {
  627. return
  628. ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
  629. ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
  630. ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
  631. ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
  632. ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
  633. ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
  634. ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
  635. ref_compare( base_type::a8_, rhs.a8_, 0 ) &&
  636. ref_compare( base_type::a9_, rhs.a9_, 0 );
  637. }
  638. };
  639. #ifdef BOOST_MSVC
  640. #pragma warning(pop)
  641. #endif
  642. // bind_t
  643. #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
  644. template< class A1 > class rrlist1
  645. {
  646. private:
  647. A1 & a1_; // not A1&& because of msvc-10.0
  648. public:
  649. explicit rrlist1( A1 & a1 ): a1_( a1 ) {}
  650. A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); } // not static_cast because of g++ 4.9
  651. A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
  652. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  653. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  654. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  655. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
  656. {
  657. rrlist1<A1&> a( a1_ );
  658. return b.eval( a );
  659. }
  660. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
  661. {
  662. rrlist1<A1&> a( a1_ );
  663. return b.eval( a );
  664. }
  665. };
  666. template< class A1, class A2 > class rrlist2
  667. {
  668. private:
  669. A1 & a1_;
  670. A2 & a2_;
  671. public:
  672. rrlist2( A1 & a1, A2 & a2 ): a1_( a1 ), a2_( a2 ) {}
  673. A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
  674. A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
  675. A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
  676. A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
  677. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  678. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  679. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  680. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
  681. {
  682. rrlist2<A1&, A2&> a( a1_, a2_ );
  683. return b.eval( a );
  684. }
  685. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
  686. {
  687. rrlist2<A1&, A2&> a( a1_, a2_ );
  688. return b.eval( a );
  689. }
  690. };
  691. template< class A1, class A2, class A3 > class rrlist3
  692. {
  693. private:
  694. A1 & a1_;
  695. A2 & a2_;
  696. A3 & a3_;
  697. public:
  698. rrlist3( A1 & a1, A2 & a2, A3 & a3 ): a1_( a1 ), a2_( a2 ), a3_( a3 ) {}
  699. A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
  700. A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
  701. A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
  702. A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
  703. A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
  704. A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
  705. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  706. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  707. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  708. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
  709. {
  710. rrlist3<A1&, A2&, A3&> a( a1_, a2_, a3_ );
  711. return b.eval( a );
  712. }
  713. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
  714. {
  715. rrlist3<A1&, A2&, A3&> a( a1_, a2_, a3_ );
  716. return b.eval( a );
  717. }
  718. };
  719. template< class A1, class A2, class A3, class A4 > class rrlist4
  720. {
  721. private:
  722. A1 & a1_;
  723. A2 & a2_;
  724. A3 & a3_;
  725. A4 & a4_;
  726. public:
  727. rrlist4( A1 & a1, A2 & a2, A3 & a3, A4 & a4 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ) {}
  728. A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
  729. A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
  730. A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
  731. A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
  732. A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
  733. A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
  734. A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
  735. A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
  736. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  737. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  738. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  739. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
  740. {
  741. rrlist4<A1&, A2&, A3&, A4&> a( a1_, a2_, a3_, a4_ );
  742. return b.eval( a );
  743. }
  744. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
  745. {
  746. rrlist4<A1&, A2&, A3&, A4&> a( a1_, a2_, a3_, a4_ );
  747. return b.eval( a );
  748. }
  749. };
  750. template< class A1, class A2, class A3, class A4, class A5 > class rrlist5
  751. {
  752. private:
  753. A1 & a1_;
  754. A2 & a2_;
  755. A3 & a3_;
  756. A4 & a4_;
  757. A5 & a5_;
  758. public:
  759. rrlist5( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ) {}
  760. A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
  761. A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
  762. A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
  763. A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
  764. A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
  765. A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
  766. A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
  767. A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
  768. A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
  769. A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
  770. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  771. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  772. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  773. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
  774. {
  775. rrlist5<A1&, A2&, A3&, A4&, A5&> a( a1_, a2_, a3_, a4_, a5_ );
  776. return b.eval( a );
  777. }
  778. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
  779. {
  780. rrlist5<A1&, A2&, A3&, A4&, A5&> a( a1_, a2_, a3_, a4_, a5_ );
  781. return b.eval( a );
  782. }
  783. };
  784. template< class A1, class A2, class A3, class A4, class A5, class A6 > class rrlist6
  785. {
  786. private:
  787. A1 & a1_;
  788. A2 & a2_;
  789. A3 & a3_;
  790. A4 & a4_;
  791. A5 & a5_;
  792. A6 & a6_;
  793. public:
  794. rrlist6( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ) {}
  795. A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
  796. A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
  797. A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
  798. A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
  799. A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
  800. A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
  801. A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
  802. A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
  803. A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
  804. A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
  805. A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
  806. A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
  807. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  808. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  809. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  810. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
  811. {
  812. rrlist6<A1&, A2&, A3&, A4&, A5&, A6&> a( a1_, a2_, a3_, a4_, a5_, a6_ );
  813. return b.eval( a );
  814. }
  815. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
  816. {
  817. rrlist6<A1&, A2&, A3&, A4&, A5&, A6&> a( a1_, a2_, a3_, a4_, a5_, a6_ );
  818. return b.eval( a );
  819. }
  820. };
  821. template< class A1, class A2, class A3, class A4, class A5, class A6, class A7 > class rrlist7
  822. {
  823. private:
  824. A1 & a1_;
  825. A2 & a2_;
  826. A3 & a3_;
  827. A4 & a4_;
  828. A5 & a5_;
  829. A6 & a6_;
  830. A7 & a7_;
  831. public:
  832. rrlist7( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ) {}
  833. A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
  834. A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
  835. A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
  836. A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
  837. A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
  838. A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
  839. A7 && operator[] (boost::arg<7>) const { return std::forward<A7>( a7_ ); }
  840. A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
  841. A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
  842. A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
  843. A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
  844. A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
  845. A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
  846. A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward<A7>( a7_ ); }
  847. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  848. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  849. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  850. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
  851. {
  852. rrlist7<A1&, A2&, A3&, A4&, A5&, A6&, A7&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ );
  853. return b.eval( a );
  854. }
  855. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
  856. {
  857. rrlist7<A1&, A2&, A3&, A4&, A5&, A6&, A7&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ );
  858. return b.eval( a );
  859. }
  860. };
  861. template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class rrlist8
  862. {
  863. private:
  864. A1 & a1_;
  865. A2 & a2_;
  866. A3 & a3_;
  867. A4 & a4_;
  868. A5 & a5_;
  869. A6 & a6_;
  870. A7 & a7_;
  871. A8 & a8_;
  872. public:
  873. rrlist8( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ) {}
  874. A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
  875. A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
  876. A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
  877. A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
  878. A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
  879. A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
  880. A7 && operator[] (boost::arg<7>) const { return std::forward<A7>( a7_ ); }
  881. A8 && operator[] (boost::arg<8>) const { return std::forward<A8>( a8_ ); }
  882. A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
  883. A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
  884. A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
  885. A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
  886. A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
  887. A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
  888. A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward<A7>( a7_ ); }
  889. A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward<A8>( a8_ ); }
  890. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  891. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  892. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  893. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
  894. {
  895. rrlist8<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ );
  896. return b.eval( a );
  897. }
  898. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
  899. {
  900. rrlist8<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ );
  901. return b.eval( a );
  902. }
  903. };
  904. template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > class rrlist9
  905. {
  906. private:
  907. A1 & a1_;
  908. A2 & a2_;
  909. A3 & a3_;
  910. A4 & a4_;
  911. A5 & a5_;
  912. A6 & a6_;
  913. A7 & a7_;
  914. A8 & a8_;
  915. A9 & a9_;
  916. public:
  917. rrlist9( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ), a9_( a9 ) {}
  918. A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
  919. A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
  920. A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
  921. A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
  922. A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
  923. A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
  924. A7 && operator[] (boost::arg<7>) const { return std::forward<A7>( a7_ ); }
  925. A8 && operator[] (boost::arg<8>) const { return std::forward<A8>( a8_ ); }
  926. A9 && operator[] (boost::arg<9>) const { return std::forward<A9>( a9_ ); }
  927. A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
  928. A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
  929. A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
  930. A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
  931. A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
  932. A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
  933. A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward<A7>( a7_ ); }
  934. A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward<A8>( a8_ ); }
  935. A9 && operator[] (boost::arg<9> (*) ()) const { return std::forward<A9>( a9_ ); }
  936. template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
  937. template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
  938. template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
  939. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
  940. {
  941. rrlist9<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&, A9&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ );
  942. return b.eval( a );
  943. }
  944. template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
  945. {
  946. rrlist9<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&, A9&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ );
  947. return b.eval( a );
  948. }
  949. };
  950. template<class R, class F, class L> class bind_t
  951. {
  952. private:
  953. F f_;
  954. L l_;
  955. public:
  956. typedef typename result_traits<R, F>::type result_type;
  957. typedef bind_t this_type;
  958. bind_t( F f, L const & l ): f_( f ), l_( l ) {}
  959. //
  960. result_type operator()()
  961. {
  962. list0 a;
  963. return l_( type<result_type>(), f_, a, 0 );
  964. }
  965. result_type operator()() const
  966. {
  967. list0 a;
  968. return l_( type<result_type>(), f_, a, 0 );
  969. }
  970. template<class A1> result_type operator()( A1 && a1 )
  971. {
  972. rrlist1< A1 > a( a1 );
  973. return l_( type<result_type>(), f_, a, 0 );
  974. }
  975. template<class A1> result_type operator()( A1 && a1 ) const
  976. {
  977. rrlist1< A1 > a( a1 );
  978. return l_(type<result_type>(), f_, a, 0);
  979. }
  980. template<class A1, class A2> result_type operator()( A1 && a1, A2 && a2 )
  981. {
  982. rrlist2< A1, A2 > a( a1, a2 );
  983. return l_( type<result_type>(), f_, a, 0 );
  984. }
  985. template<class A1, class A2> result_type operator()( A1 && a1, A2 && a2 ) const
  986. {
  987. rrlist2< A1, A2 > a( a1, a2 );
  988. return l_( type<result_type>(), f_, a, 0 );
  989. }
  990. template<class A1, class A2, class A3> result_type operator()( A1 && a1, A2 && a2, A3 && a3 )
  991. {
  992. rrlist3< A1, A2, A3 > a( a1, a2, a3 );
  993. return l_( type<result_type>(), f_, a, 0 );
  994. }
  995. template<class A1, class A2, class A3> result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) const
  996. {
  997. rrlist3< A1, A2, A3 > a( a1, a2, a3 );
  998. return l_( type<result_type>(), f_, a, 0 );
  999. }
  1000. template<class A1, class A2, class A3, class A4> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 )
  1001. {
  1002. rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 );
  1003. return l_( type<result_type>(), f_, a, 0 );
  1004. }
  1005. template<class A1, class A2, class A3, class A4> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) const
  1006. {
  1007. rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 );
  1008. return l_( type<result_type>(), f_, a, 0 );
  1009. }
  1010. template<class A1, class A2, class A3, class A4, class A5> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 )
  1011. {
  1012. rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 );
  1013. return l_( type<result_type>(), f_, a, 0 );
  1014. }
  1015. template<class A1, class A2, class A3, class A4, class A5> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) const
  1016. {
  1017. rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 );
  1018. return l_( type<result_type>(), f_, a, 0 );
  1019. }
  1020. template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 )
  1021. {
  1022. rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 );
  1023. return l_( type<result_type>(), f_, a, 0 );
  1024. }
  1025. template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) const
  1026. {
  1027. rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 );
  1028. return l_( type<result_type>(), f_, a, 0 );
  1029. }
  1030. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 )
  1031. {
  1032. rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 );
  1033. return l_( type<result_type>(), f_, a, 0 );
  1034. }
  1035. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) const
  1036. {
  1037. rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 );
  1038. return l_( type<result_type>(), f_, a, 0 );
  1039. }
  1040. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 )
  1041. {
  1042. rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 );
  1043. return l_( type<result_type>(), f_, a, 0 );
  1044. }
  1045. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) const
  1046. {
  1047. rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 );
  1048. return l_( type<result_type>(), f_, a, 0 );
  1049. }
  1050. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 )
  1051. {
  1052. rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
  1053. return l_( type<result_type>(), f_, a, 0 );
  1054. }
  1055. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) const
  1056. {
  1057. rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
  1058. return l_( type<result_type>(), f_, a, 0 );
  1059. }
  1060. //
  1061. template<class A> result_type eval( A & a )
  1062. {
  1063. return l_( type<result_type>(), f_, a, 0 );
  1064. }
  1065. template<class A> result_type eval( A & a ) const
  1066. {
  1067. return l_( type<result_type>(), f_, a, 0 );
  1068. }
  1069. template<class V> void accept( V & v ) const
  1070. {
  1071. #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ )
  1072. using boost::visit_each;
  1073. #endif
  1074. BOOST_BIND_VISIT_EACH( v, f_, 0 );
  1075. l_.accept( v );
  1076. }
  1077. bool compare( this_type const & rhs ) const
  1078. {
  1079. return ref_compare( f_, rhs.f_, 0 ) && l_ == rhs.l_;
  1080. }
  1081. };
  1082. #elif !defined( BOOST_NO_VOID_RETURNS )
  1083. template<class R, class F, class L> class bind_t
  1084. {
  1085. public:
  1086. typedef bind_t this_type;
  1087. bind_t(F f, L const & l): f_(f), l_(l) {}
  1088. #define BOOST_BIND_RETURN return
  1089. #include <boost/bind/bind_template.hpp>
  1090. #undef BOOST_BIND_RETURN
  1091. };
  1092. #else // no void returns
  1093. template<class R> struct bind_t_generator
  1094. {
  1095. template<class F, class L> class implementation
  1096. {
  1097. public:
  1098. typedef implementation this_type;
  1099. implementation(F f, L const & l): f_(f), l_(l) {}
  1100. #define BOOST_BIND_RETURN return
  1101. #include <boost/bind/bind_template.hpp>
  1102. #undef BOOST_BIND_RETURN
  1103. };
  1104. };
  1105. template<> struct bind_t_generator<void>
  1106. {
  1107. template<class F, class L> class implementation
  1108. {
  1109. private:
  1110. typedef void R;
  1111. public:
  1112. typedef implementation this_type;
  1113. implementation(F f, L const & l): f_(f), l_(l) {}
  1114. #define BOOST_BIND_RETURN
  1115. #include <boost/bind/bind_template.hpp>
  1116. #undef BOOST_BIND_RETURN
  1117. };
  1118. };
  1119. template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>
  1120. {
  1121. public:
  1122. bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {}
  1123. };
  1124. #endif
  1125. // function_equal
  1126. #ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  1127. // put overloads in _bi, rely on ADL
  1128. # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
  1129. template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
  1130. {
  1131. return a.compare(b);
  1132. }
  1133. # else
  1134. template<class R, class F, class L> bool function_equal_impl( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
  1135. {
  1136. return a.compare(b);
  1137. }
  1138. # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
  1139. #else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  1140. // put overloads in boost
  1141. } // namespace _bi
  1142. # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
  1143. template<class R, class F, class L> bool function_equal( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b )
  1144. {
  1145. return a.compare(b);
  1146. }
  1147. # else
  1148. template<class R, class F, class L> bool function_equal_impl( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b, int )
  1149. {
  1150. return a.compare(b);
  1151. }
  1152. # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
  1153. namespace _bi
  1154. {
  1155. #endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  1156. // add_value
  1157. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
  1158. #if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) )
  1159. template<class T> struct add_value
  1160. {
  1161. typedef _bi::value<T> type;
  1162. };
  1163. #else
  1164. template< class T, int I > struct add_value_2
  1165. {
  1166. typedef boost::arg<I> type;
  1167. };
  1168. template< class T > struct add_value_2< T, 0 >
  1169. {
  1170. typedef _bi::value< T > type;
  1171. };
  1172. template<class T> struct add_value
  1173. {
  1174. typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type;
  1175. };
  1176. #endif
  1177. template<class T> struct add_value< value<T> >
  1178. {
  1179. typedef _bi::value<T> type;
  1180. };
  1181. template<class T> struct add_value< reference_wrapper<T> >
  1182. {
  1183. typedef reference_wrapper<T> type;
  1184. };
  1185. template<int I> struct add_value< arg<I> >
  1186. {
  1187. typedef boost::arg<I> type;
  1188. };
  1189. template<int I> struct add_value< arg<I> (*) () >
  1190. {
  1191. typedef boost::arg<I> (*type) ();
  1192. };
  1193. template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
  1194. {
  1195. typedef bind_t<R, F, L> type;
  1196. };
  1197. #else
  1198. template<int I> struct _avt_0;
  1199. template<> struct _avt_0<1>
  1200. {
  1201. template<class T> struct inner
  1202. {
  1203. typedef T type;
  1204. };
  1205. };
  1206. template<> struct _avt_0<2>
  1207. {
  1208. template<class T> struct inner
  1209. {
  1210. typedef value<T> type;
  1211. };
  1212. };
  1213. typedef char (&_avt_r1) [1];
  1214. typedef char (&_avt_r2) [2];
  1215. template<class T> _avt_r1 _avt_f(value<T>);
  1216. template<class T> _avt_r1 _avt_f(reference_wrapper<T>);
  1217. template<int I> _avt_r1 _avt_f(arg<I>);
  1218. template<int I> _avt_r1 _avt_f(arg<I> (*) ());
  1219. template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>);
  1220. _avt_r2 _avt_f(...);
  1221. template<class T> struct add_value
  1222. {
  1223. static T t();
  1224. typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type;
  1225. };
  1226. #endif
  1227. // list_av_N
  1228. template<class A1> struct list_av_1
  1229. {
  1230. typedef typename add_value<A1>::type B1;
  1231. typedef list1<B1> type;
  1232. };
  1233. template<class A1, class A2> struct list_av_2
  1234. {
  1235. typedef typename add_value<A1>::type B1;
  1236. typedef typename add_value<A2>::type B2;
  1237. typedef list2<B1, B2> type;
  1238. };
  1239. template<class A1, class A2, class A3> struct list_av_3
  1240. {
  1241. typedef typename add_value<A1>::type B1;
  1242. typedef typename add_value<A2>::type B2;
  1243. typedef typename add_value<A3>::type B3;
  1244. typedef list3<B1, B2, B3> type;
  1245. };
  1246. template<class A1, class A2, class A3, class A4> struct list_av_4
  1247. {
  1248. typedef typename add_value<A1>::type B1;
  1249. typedef typename add_value<A2>::type B2;
  1250. typedef typename add_value<A3>::type B3;
  1251. typedef typename add_value<A4>::type B4;
  1252. typedef list4<B1, B2, B3, B4> type;
  1253. };
  1254. template<class A1, class A2, class A3, class A4, class A5> struct list_av_5
  1255. {
  1256. typedef typename add_value<A1>::type B1;
  1257. typedef typename add_value<A2>::type B2;
  1258. typedef typename add_value<A3>::type B3;
  1259. typedef typename add_value<A4>::type B4;
  1260. typedef typename add_value<A5>::type B5;
  1261. typedef list5<B1, B2, B3, B4, B5> type;
  1262. };
  1263. template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6
  1264. {
  1265. typedef typename add_value<A1>::type B1;
  1266. typedef typename add_value<A2>::type B2;
  1267. typedef typename add_value<A3>::type B3;
  1268. typedef typename add_value<A4>::type B4;
  1269. typedef typename add_value<A5>::type B5;
  1270. typedef typename add_value<A6>::type B6;
  1271. typedef list6<B1, B2, B3, B4, B5, B6> type;
  1272. };
  1273. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7
  1274. {
  1275. typedef typename add_value<A1>::type B1;
  1276. typedef typename add_value<A2>::type B2;
  1277. typedef typename add_value<A3>::type B3;
  1278. typedef typename add_value<A4>::type B4;
  1279. typedef typename add_value<A5>::type B5;
  1280. typedef typename add_value<A6>::type B6;
  1281. typedef typename add_value<A7>::type B7;
  1282. typedef list7<B1, B2, B3, B4, B5, B6, B7> type;
  1283. };
  1284. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8
  1285. {
  1286. typedef typename add_value<A1>::type B1;
  1287. typedef typename add_value<A2>::type B2;
  1288. typedef typename add_value<A3>::type B3;
  1289. typedef typename add_value<A4>::type B4;
  1290. typedef typename add_value<A5>::type B5;
  1291. typedef typename add_value<A6>::type B6;
  1292. typedef typename add_value<A7>::type B7;
  1293. typedef typename add_value<A8>::type B8;
  1294. typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type;
  1295. };
  1296. template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9
  1297. {
  1298. typedef typename add_value<A1>::type B1;
  1299. typedef typename add_value<A2>::type B2;
  1300. typedef typename add_value<A3>::type B3;
  1301. typedef typename add_value<A4>::type B4;
  1302. typedef typename add_value<A5>::type B5;
  1303. typedef typename add_value<A6>::type B6;
  1304. typedef typename add_value<A7>::type B7;
  1305. typedef typename add_value<A8>::type B8;
  1306. typedef typename add_value<A9>::type B9;
  1307. typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
  1308. };
  1309. // operator!
  1310. struct logical_not
  1311. {
  1312. template<class V> bool operator()(V const & v) const { return !v; }
  1313. };
  1314. template<class R, class F, class L>
  1315. bind_t< bool, logical_not, list1< bind_t<R, F, L> > >
  1316. operator! (bind_t<R, F, L> const & f)
  1317. {
  1318. typedef list1< bind_t<R, F, L> > list_type;
  1319. return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
  1320. }
  1321. // relational operators
  1322. #define BOOST_BIND_OPERATOR( op, name ) \
  1323. \
  1324. struct name \
  1325. { \
  1326. template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
  1327. }; \
  1328. \
  1329. template<class R, class F, class L, class A2> \
  1330. bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \
  1331. operator op (bind_t<R, F, L> const & f, A2 a2) \
  1332. { \
  1333. typedef typename add_value<A2>::type B2; \
  1334. typedef list2< bind_t<R, F, L>, B2> list_type; \
  1335. return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
  1336. }
  1337. BOOST_BIND_OPERATOR( ==, equal )
  1338. BOOST_BIND_OPERATOR( !=, not_equal )
  1339. BOOST_BIND_OPERATOR( <, less )
  1340. BOOST_BIND_OPERATOR( <=, less_equal )
  1341. BOOST_BIND_OPERATOR( >, greater )
  1342. BOOST_BIND_OPERATOR( >=, greater_equal )
  1343. BOOST_BIND_OPERATOR( &&, logical_and )
  1344. BOOST_BIND_OPERATOR( ||, logical_or )
  1345. #undef BOOST_BIND_OPERATOR
  1346. #if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)
  1347. // resolve ambiguity with rel_ops
  1348. #define BOOST_BIND_OPERATOR( op, name ) \
  1349. \
  1350. template<class R, class F, class L> \
  1351. bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \
  1352. operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \
  1353. { \
  1354. typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \
  1355. return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \
  1356. }
  1357. BOOST_BIND_OPERATOR( !=, not_equal )
  1358. BOOST_BIND_OPERATOR( <=, less_equal )
  1359. BOOST_BIND_OPERATOR( >, greater )
  1360. BOOST_BIND_OPERATOR( >=, greater_equal )
  1361. #endif
  1362. // visit_each, ADL
  1363. #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \
  1364. && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
  1365. template<class V, class T> void visit_each( V & v, value<T> const & t, int )
  1366. {
  1367. using boost::visit_each;
  1368. BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
  1369. }
  1370. template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
  1371. {
  1372. t.accept( v );
  1373. }
  1374. #endif
  1375. } // namespace _bi
  1376. // visit_each, no ADL
  1377. #if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \
  1378. || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
  1379. template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int )
  1380. {
  1381. BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
  1382. }
  1383. template<class V, class R, class F, class L> void visit_each( V & v, _bi::bind_t<R, F, L> const & t, int )
  1384. {
  1385. t.accept( v );
  1386. }
  1387. #endif
  1388. // is_bind_expression
  1389. template< class T > struct is_bind_expression
  1390. {
  1391. enum _vt { value = 0 };
  1392. };
  1393. #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
  1394. template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > >
  1395. {
  1396. enum _vt { value = 1 };
  1397. };
  1398. #endif
  1399. // bind
  1400. #ifndef BOOST_BIND
  1401. #define BOOST_BIND bind
  1402. #endif
  1403. // generic function objects
  1404. template<class R, class F>
  1405. _bi::bind_t<R, F, _bi::list0>
  1406. BOOST_BIND(F f)
  1407. {
  1408. typedef _bi::list0 list_type;
  1409. return _bi::bind_t<R, F, list_type> (f, list_type());
  1410. }
  1411. template<class R, class F, class A1>
  1412. _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
  1413. BOOST_BIND(F f, A1 a1)
  1414. {
  1415. typedef typename _bi::list_av_1<A1>::type list_type;
  1416. return _bi::bind_t<R, F, list_type> (f, list_type(a1));
  1417. }
  1418. template<class R, class F, class A1, class A2>
  1419. _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
  1420. BOOST_BIND(F f, A1 a1, A2 a2)
  1421. {
  1422. typedef typename _bi::list_av_2<A1, A2>::type list_type;
  1423. return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
  1424. }
  1425. template<class R, class F, class A1, class A2, class A3>
  1426. _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
  1427. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
  1428. {
  1429. typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
  1430. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
  1431. }
  1432. template<class R, class F, class A1, class A2, class A3, class A4>
  1433. _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
  1434. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
  1435. {
  1436. typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
  1437. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
  1438. }
  1439. template<class R, class F, class A1, class A2, class A3, class A4, class A5>
  1440. _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
  1441. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
  1442. {
  1443. typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
  1444. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
  1445. }
  1446. template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
  1447. _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
  1448. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
  1449. {
  1450. typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
  1451. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
  1452. }
  1453. template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
  1454. _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
  1455. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
  1456. {
  1457. typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
  1458. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
  1459. }
  1460. template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
  1461. _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
  1462. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
  1463. {
  1464. typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
  1465. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
  1466. }
  1467. template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
  1468. _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
  1469. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
  1470. {
  1471. typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
  1472. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
  1473. }
  1474. // generic function objects, alternative syntax
  1475. template<class R, class F>
  1476. _bi::bind_t<R, F, _bi::list0>
  1477. BOOST_BIND(boost::type<R>, F f)
  1478. {
  1479. typedef _bi::list0 list_type;
  1480. return _bi::bind_t<R, F, list_type> (f, list_type());
  1481. }
  1482. template<class R, class F, class A1>
  1483. _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
  1484. BOOST_BIND(boost::type<R>, F f, A1 a1)
  1485. {
  1486. typedef typename _bi::list_av_1<A1>::type list_type;
  1487. return _bi::bind_t<R, F, list_type> (f, list_type(a1));
  1488. }
  1489. template<class R, class F, class A1, class A2>
  1490. _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
  1491. BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2)
  1492. {
  1493. typedef typename _bi::list_av_2<A1, A2>::type list_type;
  1494. return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
  1495. }
  1496. template<class R, class F, class A1, class A2, class A3>
  1497. _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
  1498. BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3)
  1499. {
  1500. typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
  1501. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
  1502. }
  1503. template<class R, class F, class A1, class A2, class A3, class A4>
  1504. _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
  1505. BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4)
  1506. {
  1507. typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
  1508. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
  1509. }
  1510. template<class R, class F, class A1, class A2, class A3, class A4, class A5>
  1511. _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
  1512. BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
  1513. {
  1514. typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
  1515. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
  1516. }
  1517. template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
  1518. _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
  1519. BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
  1520. {
  1521. typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
  1522. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
  1523. }
  1524. template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
  1525. _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
  1526. BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
  1527. {
  1528. typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
  1529. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
  1530. }
  1531. template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
  1532. _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
  1533. BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
  1534. {
  1535. typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
  1536. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
  1537. }
  1538. template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
  1539. _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
  1540. BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
  1541. {
  1542. typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
  1543. return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
  1544. }
  1545. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
  1546. // adaptable function objects
  1547. template<class F>
  1548. _bi::bind_t<_bi::unspecified, F, _bi::list0>
  1549. BOOST_BIND(F f)
  1550. {
  1551. typedef _bi::list0 list_type;
  1552. return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type());
  1553. }
  1554. template<class F, class A1>
  1555. _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type>
  1556. BOOST_BIND(F f, A1 a1)
  1557. {
  1558. typedef typename _bi::list_av_1<A1>::type list_type;
  1559. return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1));
  1560. }
  1561. template<class F, class A1, class A2>
  1562. _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type>
  1563. BOOST_BIND(F f, A1 a1, A2 a2)
  1564. {
  1565. typedef typename _bi::list_av_2<A1, A2>::type list_type;
  1566. return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2));
  1567. }
  1568. template<class F, class A1, class A2, class A3>
  1569. _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type>
  1570. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
  1571. {
  1572. typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
  1573. return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3));
  1574. }
  1575. template<class F, class A1, class A2, class A3, class A4>
  1576. _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
  1577. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
  1578. {
  1579. typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
  1580. return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4));
  1581. }
  1582. template<class F, class A1, class A2, class A3, class A4, class A5>
  1583. _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
  1584. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
  1585. {
  1586. typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
  1587. return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
  1588. }
  1589. template<class F, class A1, class A2, class A3, class A4, class A5, class A6>
  1590. _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
  1591. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
  1592. {
  1593. typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
  1594. return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
  1595. }
  1596. template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
  1597. _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
  1598. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
  1599. {
  1600. typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
  1601. return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
  1602. }
  1603. template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
  1604. _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
  1605. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
  1606. {
  1607. typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
  1608. return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
  1609. }
  1610. template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
  1611. _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
  1612. BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
  1613. {
  1614. typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
  1615. return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
  1616. }
  1617. #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
  1618. // function pointers
  1619. #define BOOST_BIND_CC
  1620. #define BOOST_BIND_ST
  1621. #define BOOST_BIND_NOEXCEPT
  1622. #include <boost/bind/bind_cc.hpp>
  1623. # if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
  1624. # undef BOOST_BIND_NOEXCEPT
  1625. # define BOOST_BIND_NOEXCEPT noexcept
  1626. # include <boost/bind/bind_cc.hpp>
  1627. # endif
  1628. #undef BOOST_BIND_CC
  1629. #undef BOOST_BIND_ST
  1630. #undef BOOST_BIND_NOEXCEPT
  1631. #if defined(BOOST_BIND_ENABLE_STDCALL) && !defined(_M_X64)
  1632. #define BOOST_BIND_CC __stdcall
  1633. #define BOOST_BIND_ST
  1634. #define BOOST_BIND_NOEXCEPT
  1635. #include <boost/bind/bind_cc.hpp>
  1636. #undef BOOST_BIND_CC
  1637. #undef BOOST_BIND_ST
  1638. #undef BOOST_BIND_NOEXCEPT
  1639. #endif
  1640. #if defined(BOOST_BIND_ENABLE_FASTCALL) && !defined(_M_X64)
  1641. #define BOOST_BIND_CC __fastcall
  1642. #define BOOST_BIND_ST
  1643. #define BOOST_BIND_NOEXCEPT
  1644. #include <boost/bind/bind_cc.hpp>
  1645. #undef BOOST_BIND_CC
  1646. #undef BOOST_BIND_ST
  1647. #undef BOOST_BIND_NOEXCEPT
  1648. #endif
  1649. #ifdef BOOST_BIND_ENABLE_PASCAL
  1650. #define BOOST_BIND_ST pascal
  1651. #define BOOST_BIND_CC
  1652. #define BOOST_BIND_NOEXCEPT
  1653. #include <boost/bind/bind_cc.hpp>
  1654. #undef BOOST_BIND_ST
  1655. #undef BOOST_BIND_CC
  1656. #undef BOOST_BIND_NOEXCEPT
  1657. #endif
  1658. // member function pointers
  1659. #define BOOST_BIND_MF_NAME(X) X
  1660. #define BOOST_BIND_MF_CC
  1661. #define BOOST_BIND_MF_NOEXCEPT
  1662. #include <boost/bind/bind_mf_cc.hpp>
  1663. #include <boost/bind/bind_mf2_cc.hpp>
  1664. # if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
  1665. # undef BOOST_BIND_MF_NOEXCEPT
  1666. # define BOOST_BIND_MF_NOEXCEPT noexcept
  1667. # include <boost/bind/bind_mf_cc.hpp>
  1668. # endif
  1669. #undef BOOST_BIND_MF_NAME
  1670. #undef BOOST_BIND_MF_CC
  1671. #undef BOOST_BIND_MF_NOEXCEPT
  1672. #if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)
  1673. #define BOOST_BIND_MF_NAME(X) X##_cdecl
  1674. #define BOOST_BIND_MF_CC __cdecl
  1675. #define BOOST_BIND_MF_NOEXCEPT
  1676. #include <boost/bind/bind_mf_cc.hpp>
  1677. #include <boost/bind/bind_mf2_cc.hpp>
  1678. #undef BOOST_BIND_MF_NAME
  1679. #undef BOOST_BIND_MF_CC
  1680. #undef BOOST_BIND_MF_NOEXCEPT
  1681. #endif
  1682. #if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64)
  1683. #define BOOST_BIND_MF_NAME(X) X##_stdcall
  1684. #define BOOST_BIND_MF_CC __stdcall
  1685. #define BOOST_BIND_MF_NOEXCEPT
  1686. #include <boost/bind/bind_mf_cc.hpp>
  1687. #include <boost/bind/bind_mf2_cc.hpp>
  1688. #undef BOOST_BIND_MF_NAME
  1689. #undef BOOST_BIND_MF_CC
  1690. #undef BOOST_BIND_MF_NOEXCEPT
  1691. #endif
  1692. #if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64)
  1693. #define BOOST_BIND_MF_NAME(X) X##_fastcall
  1694. #define BOOST_BIND_MF_CC __fastcall
  1695. #define BOOST_BIND_MF_NOEXCEPT
  1696. #include <boost/bind/bind_mf_cc.hpp>
  1697. #include <boost/bind/bind_mf2_cc.hpp>
  1698. #undef BOOST_BIND_MF_NAME
  1699. #undef BOOST_BIND_MF_CC
  1700. #undef BOOST_BIND_MF_NOEXCEPT
  1701. #endif
  1702. // data member pointers
  1703. #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
  1704. || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) ) )
  1705. template<class R, class T, class A1>
  1706. _bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
  1707. BOOST_BIND(R T::*f, A1 a1)
  1708. {
  1709. typedef _mfi::dm<R, T> F;
  1710. typedef typename _bi::list_av_1<A1>::type list_type;
  1711. return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) );
  1712. }
  1713. #else
  1714. namespace _bi
  1715. {
  1716. template< class Pm, int I > struct add_cref;
  1717. template< class M, class T > struct add_cref< M T::*, 0 >
  1718. {
  1719. typedef M type;
  1720. };
  1721. template< class M, class T > struct add_cref< M T::*, 1 >
  1722. {
  1723. #ifdef BOOST_MSVC
  1724. #pragma warning(push)
  1725. #pragma warning(disable:4180)
  1726. #endif
  1727. typedef M const & type;
  1728. #ifdef BOOST_MSVC
  1729. #pragma warning(pop)
  1730. #endif
  1731. };
  1732. template< class R, class T > struct add_cref< R (T::*) (), 1 >
  1733. {
  1734. typedef void type;
  1735. };
  1736. #if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION
  1737. template< class R, class T > struct add_cref< R (T::*) () const, 1 >
  1738. {
  1739. typedef void type;
  1740. };
  1741. #if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
  1742. template< class R, class T > struct add_cref< R (T::*) () const noexcept, 1 >
  1743. {
  1744. typedef void type;
  1745. };
  1746. #endif // __cpp_noexcept_function_type
  1747. #endif // __IBMCPP__
  1748. template<class R> struct isref
  1749. {
  1750. enum value_type { value = 0 };
  1751. };
  1752. template<class R> struct isref< R& >
  1753. {
  1754. enum value_type { value = 1 };
  1755. };
  1756. template<class R> struct isref< R* >
  1757. {
  1758. enum value_type { value = 1 };
  1759. };
  1760. template<class Pm, class A1> struct dm_result
  1761. {
  1762. typedef typename add_cref< Pm, 1 >::type type;
  1763. };
  1764. template<class Pm, class R, class F, class L> struct dm_result< Pm, bind_t<R, F, L> >
  1765. {
  1766. typedef typename bind_t<R, F, L>::result_type result_type;
  1767. typedef typename add_cref< Pm, isref< result_type >::value >::type type;
  1768. };
  1769. } // namespace _bi
  1770. template< class A1, class M, class T >
  1771. _bi::bind_t<
  1772. typename _bi::dm_result< M T::*, A1 >::type,
  1773. _mfi::dm<M, T>,
  1774. typename _bi::list_av_1<A1>::type
  1775. >
  1776. BOOST_BIND( M T::*f, A1 a1 )
  1777. {
  1778. typedef typename _bi::dm_result< M T::*, A1 >::type result_type;
  1779. typedef _mfi::dm<M, T> F;
  1780. typedef typename _bi::list_av_1<A1>::type list_type;
  1781. return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
  1782. }
  1783. #endif
  1784. } // namespace boost
  1785. #ifndef BOOST_BIND_NO_PLACEHOLDERS
  1786. # include <boost/bind/placeholders.hpp>
  1787. #endif
  1788. #ifdef BOOST_MSVC
  1789. # pragma warning(default: 4512) // assignment operator could not be generated
  1790. # pragma warning(pop)
  1791. #endif
  1792. #endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED