bind.hpp 80 KB

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