bind.hpp 79 KB

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