bind.hpp 82 KB

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