binders.hpp 118 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066
  1. /*=============================================================================
  2. Phoenix v1.2
  3. Copyright (c) 2001-2002 Joel de Guzman
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #ifndef PHOENIX_BINDERS_HPP
  8. #define PHOENIX_BINDERS_HPP
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #include <boost/spirit/home/classic/phoenix/functions.hpp>
  11. #include <boost/type_traits/is_const.hpp>
  12. #include <boost/mpl/if.hpp>
  13. ///////////////////////////////////////////////////////////////////////////////
  14. namespace phoenix {
  15. ///////////////////////////////////////////////////////////////////////////////
  16. //
  17. // Binders
  18. //
  19. // There are times when it is desireable to bind a simple functor,
  20. // function, member function or member variable for deferred
  21. // evaluation. This can be done through the binding facilities
  22. // provided below. There are template classes:
  23. //
  24. // 1) function_ptr ( function pointer binder )
  25. // 2) functor ( functor pointer binder )
  26. // 3) member_function_ptr ( member function pointer binder )
  27. // 4) member_var_ptr ( member variable pointer binder )
  28. //
  29. // These template classes are specialized lazy function classes for
  30. // functors, function pointers, member function pointers and member
  31. // variable pointers, respectively. These are subclasses of the
  32. // lazy-function class (see functions.hpp). Each of these has a
  33. // corresponding overloaded bind(x) function. Each bind(x) function
  34. // generates a suitable binder object.
  35. //
  36. // Example, given a function foo:
  37. //
  38. // void foo_(int n) { std::cout << n << std::endl; }
  39. //
  40. // Here's how the function foo is bound:
  41. //
  42. // bind(&foo_)
  43. //
  44. // This bind expression results to a lazy-function (see
  45. // functions.hpp) that is lazily evaluated. This bind expression is
  46. // also equivalent to:
  47. //
  48. // function_ptr<void, int> foo = &foo_;
  49. //
  50. // The template parameter of the function_ptr is the return and
  51. // argument types of actual signature of the function to be bound
  52. // read from left to right:
  53. //
  54. // void foo_(int); ---> function_ptr<void, int>
  55. //
  56. // Either bind(&foo_) and its equivalent foo can now be used in the
  57. // same way a lazy function (see functions.hpp) is used:
  58. //
  59. // bind(&foo_)(arg1)
  60. //
  61. // or
  62. //
  63. // foo(arg1)
  64. //
  65. // The latter, of course, being much easier to understand. This is
  66. // now a full-fledged lazy function that can finally be evaluated
  67. // by another function call invocation. A second function call will
  68. // invoke the actual foo function:
  69. //
  70. // int i = 4;
  71. // foo(arg1)(i);
  72. //
  73. // will print out "4".
  74. //
  75. // Binding functors and member functions can be done similarly.
  76. // Here's how to bind a functor (e.g. std::plus<int>):
  77. //
  78. // bind(std::plus<int>())
  79. //
  80. // or
  81. //
  82. // functor<std::plus<int> > plus;
  83. //
  84. // Again, these are full-fledged lazy functions. In this case,
  85. // unlike the first example, expect 2 arguments (std::plus<int>
  86. // needs two arguments lhs and rhs). Either or both of which can be
  87. // lazily bound:
  88. //
  89. // plus(arg1, arg2) // arg1 + arg2
  90. // plus(100, arg1) // 100 + arg1
  91. // plus(100, 200) // 300
  92. //
  93. // A bound member function takes in a pointer or reference to an
  94. // object as the first argument. For instance, given:
  95. //
  96. // struct xyz { void foo(int) const; };
  97. //
  98. // xyz's foo member function can be bound as:
  99. //
  100. // bind(&xyz::foo)
  101. //
  102. // or
  103. //
  104. // member_function_ptr<void, xyz, int> xyz_foo = &xyz::foo;
  105. //
  106. // The template parameter of the member_function_ptr is the return,
  107. // class and argument types of actual signature of the function to
  108. // be bound read from left to right:
  109. //
  110. // void xyz::foo_(int); ---> member_function_ptr<void, xyz, int>
  111. //
  112. // Take note that a member_function_ptr lazy-function expects the
  113. // first argument to be a pointer or reference to an object. Both
  114. // the object (reference or pointer) and the arguments can be
  115. // lazily bound. Examples:
  116. //
  117. // xyz obj;
  118. // xyz_foo(arg1, arg2) // arg1.foo(arg2)
  119. // xyz_foo(obj, arg1) // obj.foo(arg1)
  120. // xyz_foo(obj, 100) // obj.foo(100)
  121. //
  122. // Be reminded that var(obj) must be used to call non-const member
  123. // functions. For example, if xyz was declared as:
  124. //
  125. // struct xyz { void foo(int); };
  126. //
  127. // the pointer or reference to the object must also be non-const.
  128. // Lazily bound arguments are stored as const value by default (see
  129. // variable class in primitives.hpp).
  130. //
  131. // xyz_foo(var(obj), 100) // obj.foo(100)
  132. //
  133. // Finally, member variables can be bound much like member
  134. // functions. For instance, given:
  135. //
  136. // struct xyz { int v; };
  137. //
  138. // xyz::v can be bound as:
  139. //
  140. // bind(&xyz::v)
  141. // or
  142. //
  143. // member_var_ptr<int, xyz> xyz_v = &xyz::v;
  144. //
  145. // The template parameter of the member_var_ptr is the type of the
  146. // variable followed by the class:
  147. //
  148. // int xyz::v; ---> member_var_ptr<int, xyz>
  149. //
  150. // Just like the member_function_ptr, member_var_ptr also expects
  151. // the first argument to be a pointer or reference to an object.
  152. // Both the object (reference or pointer) and the arguments can be
  153. // lazily bound. Examples:
  154. //
  155. // xyz obj;
  156. // xyz_v(arg1) // arg1.v
  157. // xyz_v(obj) // obj.v
  158. //
  159. ///////////////////////////////////////////////////////////////////////////////
  160. ///////////////////////////////////////////////////////////////////////////////
  161. //
  162. // Functor binder
  163. //
  164. ///////////////////////////////////////////////////////////////////////////////
  165. template <typename FuncT>
  166. struct functor_action : public FuncT {
  167. #if !defined(__BORLANDC__) && (!defined(__MWERKS__) || (__MWERKS__ > 0x3002))
  168. template <
  169. typename A = nil_t
  170. , typename B = nil_t
  171. , typename C = nil_t
  172. #if PHOENIX_LIMIT > 3
  173. , typename D = nil_t
  174. , typename E = nil_t
  175. , typename F = nil_t
  176. #if PHOENIX_LIMIT > 6
  177. , typename G = nil_t
  178. , typename H = nil_t
  179. , typename I = nil_t
  180. #if PHOENIX_LIMIT > 9
  181. , typename J = nil_t
  182. , typename K = nil_t
  183. , typename L = nil_t
  184. #if PHOENIX_LIMIT > 12
  185. , typename M = nil_t
  186. , typename N = nil_t
  187. , typename O = nil_t
  188. #endif
  189. #endif
  190. #endif
  191. #endif
  192. >
  193. struct result { typedef typename FuncT::result_type type; };
  194. #endif
  195. functor_action(FuncT fptr_ = FuncT())
  196. : FuncT(fptr_) {}
  197. };
  198. #if defined(__BORLANDC__) || (defined(__MWERKS__) && (__MWERKS__ <= 0x3002))
  199. ///////////////////////////////////////////////////////////////////////////////
  200. //
  201. // The following specializations are needed because Borland and CodeWarrior
  202. // does not accept default template arguments in nested template classes in
  203. // classes (i.e functor_action::result)
  204. //
  205. ///////////////////////////////////////////////////////////////////////////////
  206. template <typename FuncT, typename TupleT>
  207. struct composite0_result<functor_action<FuncT>, TupleT> {
  208. typedef typename FuncT::result_type type;
  209. };
  210. //////////////////////////////////
  211. template <typename FuncT, typename TupleT,
  212. typename A>
  213. struct composite1_result<functor_action<FuncT>, TupleT, A> {
  214. typedef typename FuncT::result_type type;
  215. };
  216. //////////////////////////////////
  217. template <typename FuncT, typename TupleT,
  218. typename A, typename B>
  219. struct composite2_result<functor_action<FuncT>, TupleT, A, B> {
  220. typedef typename FuncT::result_type type;
  221. };
  222. //////////////////////////////////
  223. template <typename FuncT, typename TupleT,
  224. typename A, typename B, typename C>
  225. struct composite3_result<functor_action<FuncT>, TupleT, A, B, C> {
  226. typedef typename FuncT::result_type type;
  227. };
  228. #if PHOENIX_LIMIT > 3
  229. //////////////////////////////////
  230. template <typename FuncT, typename TupleT,
  231. typename A, typename B, typename C, typename D>
  232. struct composite4_result<functor_action<FuncT>, TupleT,
  233. A, B, C, D> {
  234. typedef typename FuncT::result_type type;
  235. };
  236. //////////////////////////////////
  237. template <typename FuncT, typename TupleT,
  238. typename A, typename B, typename C, typename D, typename E>
  239. struct composite5_result<functor_action<FuncT>, TupleT,
  240. A, B, C, D, E> {
  241. typedef typename FuncT::result_type type;
  242. };
  243. //////////////////////////////////
  244. template <typename FuncT, typename TupleT,
  245. typename A, typename B, typename C, typename D, typename E,
  246. typename F>
  247. struct composite6_result<functor_action<FuncT>, TupleT,
  248. A, B, C, D, E, F> {
  249. typedef typename FuncT::result_type type;
  250. };
  251. #if PHOENIX_LIMIT > 6
  252. //////////////////////////////////
  253. template <typename FuncT, typename TupleT,
  254. typename A, typename B, typename C, typename D, typename E,
  255. typename F, typename G>
  256. struct composite7_result<functor_action<FuncT>, TupleT,
  257. A, B, C, D, E, F, G> {
  258. typedef typename FuncT::result_type type;
  259. };
  260. //////////////////////////////////
  261. template <typename FuncT, typename TupleT,
  262. typename A, typename B, typename C, typename D, typename E,
  263. typename F, typename G, typename H>
  264. struct composite8_result<functor_action<FuncT>, TupleT,
  265. A, B, C, D, E, F, G, H> {
  266. typedef typename FuncT::result_type type;
  267. };
  268. //////////////////////////////////
  269. template <typename FuncT, typename TupleT,
  270. typename A, typename B, typename C, typename D, typename E,
  271. typename F, typename G, typename H, typename I>
  272. struct composite9_result<functor_action<FuncT>, TupleT,
  273. A, B, C, D, E, F, G, H, I> {
  274. typedef typename FuncT::result_type type;
  275. };
  276. #if PHOENIX_LIMIT > 9
  277. //////////////////////////////////
  278. template <typename FuncT, typename TupleT,
  279. typename A, typename B, typename C, typename D, typename E,
  280. typename F, typename G, typename H, typename I, typename J>
  281. struct composite10_result<functor_action<FuncT>, TupleT,
  282. A, B, C, D, E, F, G, H, I, J> {
  283. typedef typename FuncT::result_type type;
  284. };
  285. //////////////////////////////////
  286. template <typename FuncT, typename TupleT,
  287. typename A, typename B, typename C, typename D, typename E,
  288. typename F, typename G, typename H, typename I, typename J,
  289. typename K>
  290. struct composite11_result<functor_action<FuncT>, TupleT,
  291. A, B, C, D, E, F, G, H, I, J, K> {
  292. typedef typename FuncT::result_type type;
  293. };
  294. //////////////////////////////////
  295. template <typename FuncT, typename TupleT,
  296. typename A, typename B, typename C, typename D, typename E,
  297. typename F, typename G, typename H, typename I, typename J,
  298. typename K, typename L>
  299. struct composite12_result<functor_action<FuncT>, TupleT,
  300. A, B, C, D, E, F, G, H, I, J, K, L> {
  301. typedef typename FuncT::result_type type;
  302. };
  303. #if PHOENIX_LIMIT > 12
  304. //////////////////////////////////
  305. template <typename FuncT, typename TupleT,
  306. typename A, typename B, typename C, typename D, typename E,
  307. typename F, typename G, typename H, typename I, typename J,
  308. typename K, typename L, typename M>
  309. struct composite13_result<functor_action<FuncT>, TupleT,
  310. A, B, C, D, E, F, G, H, I, J, K, L, M> {
  311. typedef typename FuncT::result_type type;
  312. };
  313. //////////////////////////////////
  314. template <typename FuncT, typename TupleT,
  315. typename A, typename B, typename C, typename D, typename E,
  316. typename F, typename G, typename H, typename I, typename J,
  317. typename K, typename L, typename M, typename N>
  318. struct composite14_result<functor_action<FuncT>, TupleT,
  319. A, B, C, D, E, F, G, H, I, J, K, L, M, N> {
  320. typedef typename FuncT::result_type type;
  321. };
  322. //////////////////////////////////
  323. template <typename FuncT, typename TupleT,
  324. typename A, typename B, typename C, typename D, typename E,
  325. typename F, typename G, typename H, typename I, typename J,
  326. typename K, typename L, typename M, typename N, typename O>
  327. struct composite15_result<functor_action<FuncT>, TupleT,
  328. A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> {
  329. typedef typename FuncT::result_type type;
  330. };
  331. #endif
  332. #endif
  333. #endif
  334. #endif
  335. #endif
  336. //////////////////////////////////
  337. template <typename FuncT>
  338. struct functor : public function<functor_action<FuncT> > {
  339. functor(FuncT func)
  340. : function<functor_action<FuncT> >(functor_action<FuncT>(func)) {};
  341. };
  342. //////////////////////////////////
  343. template <typename FuncT>
  344. inline functor<FuncT>
  345. bind(FuncT func)
  346. {
  347. return functor<FuncT>(func);
  348. }
  349. ///////////////////////////////////////////////////////////////////////////////
  350. //
  351. // Member variable pointer binder
  352. //
  353. ///////////////////////////////////////////////////////////////////////////////
  354. namespace impl {
  355. //////////////////////////////////
  356. template <typename T>
  357. struct as_ptr {
  358. typedef T* pointer_type;
  359. static T* get(T& ref)
  360. { return &ref; }
  361. };
  362. //////////////////////////////////
  363. template <typename T>
  364. struct as_ptr<T*> {
  365. typedef T* pointer_type;
  366. static T* get(T* ptr)
  367. { return ptr; }
  368. };
  369. }
  370. //////////////////////////////////
  371. template <typename ActionT, typename ClassT>
  372. struct member_var_ptr_action_result {
  373. typedef typename ActionT::template result<ClassT>::type type;
  374. };
  375. //////////////////////////////////
  376. template <typename T, typename ClassT>
  377. struct member_var_ptr_action {
  378. typedef member_var_ptr_action<T, ClassT> self_t;
  379. template <typename CT>
  380. struct result {
  381. typedef typename boost::mpl::if_<boost::is_const<CT>, T const&, T&
  382. >::type type;
  383. };
  384. typedef T ClassT::*mem_var_ptr_t;
  385. member_var_ptr_action(mem_var_ptr_t ptr_)
  386. : ptr(ptr_) {}
  387. template <typename CT>
  388. typename member_var_ptr_action_result<self_t, CT>::type
  389. operator()(CT& obj) const
  390. { return impl::as_ptr<CT>::get(obj)->*ptr; }
  391. mem_var_ptr_t ptr;
  392. };
  393. //////////////////////////////////
  394. template <typename T, typename ClassT>
  395. struct member_var_ptr
  396. : public function<member_var_ptr_action<T, ClassT> > {
  397. member_var_ptr(T ClassT::*mp)
  398. : function<member_var_ptr_action<T, ClassT> >
  399. (member_var_ptr_action<T, ClassT>(mp)) {}
  400. };
  401. //////////////////////////////////
  402. template <typename T, typename ClassT>
  403. inline member_var_ptr<T, ClassT>
  404. bind(T ClassT::*mp)
  405. {
  406. return member_var_ptr<T, ClassT>(mp);
  407. }
  408. ///////////////////////////////////////////////////////////////////////////////
  409. //
  410. // Function pointer binder (main class)
  411. //
  412. ///////////////////////////////////////////////////////////////////////////////
  413. template <
  414. typename RT
  415. , typename A = nil_t
  416. , typename B = nil_t
  417. , typename C = nil_t
  418. #if PHOENIX_LIMIT > 3
  419. , typename D = nil_t
  420. , typename E = nil_t
  421. , typename F = nil_t
  422. #if PHOENIX_LIMIT > 6
  423. , typename G = nil_t
  424. , typename H = nil_t
  425. , typename I = nil_t
  426. #if PHOENIX_LIMIT > 9
  427. , typename J = nil_t
  428. , typename K = nil_t
  429. , typename L = nil_t
  430. #if PHOENIX_LIMIT > 12
  431. , typename M = nil_t
  432. , typename N = nil_t
  433. , typename O = nil_t
  434. #endif
  435. #endif
  436. #endif
  437. #endif
  438. , typename NU = nil_t // Not used
  439. >
  440. struct function_ptr_action;
  441. //////////////////////////////////
  442. template <
  443. typename RT
  444. , typename A = nil_t
  445. , typename B = nil_t
  446. , typename C = nil_t
  447. #if PHOENIX_LIMIT > 3
  448. , typename D = nil_t
  449. , typename E = nil_t
  450. , typename F = nil_t
  451. #if PHOENIX_LIMIT > 6
  452. , typename G = nil_t
  453. , typename H = nil_t
  454. , typename I = nil_t
  455. #if PHOENIX_LIMIT > 9
  456. , typename J = nil_t
  457. , typename K = nil_t
  458. , typename L = nil_t
  459. #if PHOENIX_LIMIT > 12
  460. , typename M = nil_t
  461. , typename N = nil_t
  462. , typename O = nil_t
  463. #endif
  464. #endif
  465. #endif
  466. #endif
  467. >
  468. struct function_ptr
  469. : public function<function_ptr_action<RT
  470. , A, B, C
  471. #if PHOENIX_LIMIT > 3
  472. , D, E, F
  473. #if PHOENIX_LIMIT > 6
  474. , G, H, I
  475. #if PHOENIX_LIMIT > 9
  476. , J, K, L
  477. #if PHOENIX_LIMIT > 12
  478. , M, N, O
  479. #endif
  480. #endif
  481. #endif
  482. #endif
  483. > > {
  484. typedef function_ptr_action<RT
  485. , A, B, C
  486. #if PHOENIX_LIMIT > 3
  487. , D, E, F
  488. #if PHOENIX_LIMIT > 6
  489. , G, H, I
  490. #if PHOENIX_LIMIT > 9
  491. , J, K, L
  492. #if PHOENIX_LIMIT > 12
  493. , M, N, O
  494. #endif
  495. #endif
  496. #endif
  497. #endif
  498. > action_t;
  499. template <typename FPT>
  500. function_ptr(FPT fp)
  501. : function<action_t>(action_t(fp)) {}
  502. };
  503. ///////////////////////////////////////////////////////////////////////////////
  504. //
  505. // Function pointer binder (specialization for 0 arg)
  506. //
  507. ///////////////////////////////////////////////////////////////////////////////
  508. template <typename RT>
  509. struct function_ptr_action<RT,
  510. nil_t, nil_t, nil_t,
  511. #if PHOENIX_LIMIT > 3
  512. nil_t, nil_t, nil_t,
  513. #if PHOENIX_LIMIT > 6
  514. nil_t, nil_t, nil_t,
  515. #if PHOENIX_LIMIT > 9
  516. nil_t, nil_t, nil_t,
  517. #if PHOENIX_LIMIT > 12
  518. nil_t, nil_t, nil_t,
  519. #endif
  520. #endif
  521. #endif
  522. #endif
  523. nil_t // Unused
  524. > {
  525. typedef RT result_type;
  526. typedef RT(*func_ptr_t)();
  527. function_ptr_action(func_ptr_t fptr_)
  528. : fptr(fptr_) {}
  529. result_type operator()() const
  530. { return fptr(); }
  531. func_ptr_t fptr;
  532. };
  533. //////////////////////////////////
  534. template <typename RT>
  535. inline function_ptr<RT>
  536. bind(RT(*fptr)())
  537. {
  538. return function_ptr<RT>(fptr);
  539. }
  540. ///////////////////////////////////////////////////////////////////////////////
  541. //
  542. // Function pointer binder (specialization for 1 arg)
  543. //
  544. ///////////////////////////////////////////////////////////////////////////////
  545. template <typename RT, typename A>
  546. struct function_ptr_action<RT,
  547. A, nil_t, nil_t,
  548. #if PHOENIX_LIMIT > 3
  549. nil_t, nil_t, nil_t,
  550. #if PHOENIX_LIMIT > 6
  551. nil_t, nil_t, nil_t,
  552. #if PHOENIX_LIMIT > 9
  553. nil_t, nil_t, nil_t,
  554. #if PHOENIX_LIMIT > 12
  555. nil_t, nil_t, nil_t,
  556. #endif
  557. #endif
  558. #endif
  559. #endif
  560. nil_t // Unused
  561. > {
  562. typedef RT result_type;
  563. typedef RT(*func_ptr_t)(A);
  564. template <typename A_>
  565. struct result { typedef result_type type; };
  566. function_ptr_action(func_ptr_t fptr_)
  567. : fptr(fptr_) {}
  568. result_type operator()(A a) const
  569. { return fptr(a); }
  570. func_ptr_t fptr;
  571. };
  572. //////////////////////////////////
  573. template <typename RT, typename A>
  574. inline function_ptr<RT, A>
  575. bind(RT(*fptr)(A))
  576. {
  577. return function_ptr<RT, A>(fptr);
  578. }
  579. ///////////////////////////////////////////////////////////////////////////////
  580. //
  581. // Function pointer binder (specialization for 2 args)
  582. //
  583. ///////////////////////////////////////////////////////////////////////////////
  584. template <typename RT, typename A, typename B>
  585. struct function_ptr_action<RT,
  586. A, B, nil_t,
  587. #if PHOENIX_LIMIT > 3
  588. nil_t, nil_t, nil_t,
  589. #if PHOENIX_LIMIT > 6
  590. nil_t, nil_t, nil_t,
  591. #if PHOENIX_LIMIT > 9
  592. nil_t, nil_t, nil_t,
  593. #if PHOENIX_LIMIT > 12
  594. nil_t, nil_t, nil_t,
  595. #endif
  596. #endif
  597. #endif
  598. #endif
  599. nil_t // Unused
  600. > {
  601. typedef RT result_type;
  602. typedef RT(*func_ptr_t)(A, B);
  603. template <typename A_, typename B_>
  604. struct result { typedef result_type type; };
  605. function_ptr_action(func_ptr_t fptr_)
  606. : fptr(fptr_) {}
  607. result_type operator()(A a, B b) const
  608. { return fptr(a, b); }
  609. func_ptr_t fptr;
  610. };
  611. //////////////////////////////////
  612. template <typename RT, typename A, typename B>
  613. inline function_ptr<RT, A, B>
  614. bind(RT(*fptr)(A, B))
  615. {
  616. return function_ptr<RT, A, B>(fptr);
  617. }
  618. ///////////////////////////////////////////////////////////////////////////////
  619. //
  620. // Function pointer binder (specialization for 3 args)
  621. //
  622. ///////////////////////////////////////////////////////////////////////////////
  623. template <typename RT, typename A, typename B, typename C>
  624. struct function_ptr_action<RT,
  625. A, B, C,
  626. #if PHOENIX_LIMIT > 3
  627. nil_t, nil_t, nil_t,
  628. #if PHOENIX_LIMIT > 6
  629. nil_t, nil_t, nil_t,
  630. #if PHOENIX_LIMIT > 9
  631. nil_t, nil_t, nil_t,
  632. #if PHOENIX_LIMIT > 12
  633. nil_t, nil_t, nil_t,
  634. #endif
  635. #endif
  636. #endif
  637. #endif
  638. nil_t // Unused
  639. > {
  640. typedef RT result_type;
  641. typedef RT(*func_ptr_t)(A, B, C);
  642. template <typename A_, typename B_, typename C_>
  643. struct result { typedef result_type type; };
  644. function_ptr_action(func_ptr_t fptr_)
  645. : fptr(fptr_) {}
  646. result_type operator()(A a, B b, C c) const
  647. { return fptr(a, b, c); }
  648. func_ptr_t fptr;
  649. };
  650. //////////////////////////////////
  651. template <typename RT, typename A, typename B, typename C>
  652. inline function_ptr<RT, A, B, C>
  653. bind(RT(*fptr)(A, B, C))
  654. {
  655. return function_ptr<RT, A, B, C>(fptr);
  656. }
  657. #if PHOENIX_LIMIT > 3
  658. ///////////////////////////////////////////////////////////////////////////////
  659. //
  660. // Function pointer binder (specialization for 4 args)
  661. //
  662. ///////////////////////////////////////////////////////////////////////////////
  663. template <typename RT, typename A, typename B, typename C, typename D>
  664. struct function_ptr_action<RT,
  665. A, B, C, D, nil_t, nil_t,
  666. #if PHOENIX_LIMIT > 6
  667. nil_t, nil_t, nil_t,
  668. #if PHOENIX_LIMIT > 9
  669. nil_t, nil_t, nil_t,
  670. #if PHOENIX_LIMIT > 12
  671. nil_t, nil_t, nil_t,
  672. #endif
  673. #endif
  674. #endif
  675. nil_t // Unused
  676. > {
  677. typedef RT result_type;
  678. typedef RT(*func_ptr_t)(A, B, C, D);
  679. template <typename A_, typename B_, typename C_, typename D_>
  680. struct result { typedef result_type type; };
  681. function_ptr_action(func_ptr_t fptr_)
  682. : fptr(fptr_) {}
  683. result_type operator()(A a, B b, C c, D d) const
  684. { return fptr(a, b, c, d); }
  685. func_ptr_t fptr;
  686. };
  687. //////////////////////////////////
  688. template <typename RT, typename A, typename B, typename C, typename D>
  689. inline function_ptr<RT, A, B, C, D>
  690. bind(RT(*fptr)(A, B, C, D))
  691. {
  692. return function_ptr<RT, A, B, C, D>(fptr);
  693. }
  694. ///////////////////////////////////////////////////////////////////////////////
  695. //
  696. // Function pointer binder (specialization for 5 args)
  697. //
  698. ///////////////////////////////////////////////////////////////////////////////
  699. template <typename RT,
  700. typename A, typename B, typename C, typename D, typename E
  701. >
  702. struct function_ptr_action<RT,
  703. A, B, C, D, E, nil_t,
  704. #if PHOENIX_LIMIT > 6
  705. nil_t, nil_t, nil_t,
  706. #if PHOENIX_LIMIT > 9
  707. nil_t, nil_t, nil_t,
  708. #if PHOENIX_LIMIT > 12
  709. nil_t, nil_t, nil_t,
  710. #endif
  711. #endif
  712. #endif
  713. nil_t // Unused
  714. > {
  715. typedef RT result_type;
  716. typedef RT(*func_ptr_t)(A, B, C, D, E);
  717. template <
  718. typename A_, typename B_, typename C_, typename D_, typename E_
  719. >
  720. struct result { typedef result_type type; };
  721. function_ptr_action(func_ptr_t fptr_)
  722. : fptr(fptr_) {}
  723. result_type operator()(
  724. A a, B b, C c, D d, E e
  725. ) const
  726. { return fptr(a, b, c, d, e); }
  727. func_ptr_t fptr;
  728. };
  729. //////////////////////////////////
  730. template <typename RT,
  731. typename A, typename B, typename C, typename D, typename E
  732. >
  733. inline function_ptr<RT, A, B, C, D, E>
  734. bind(RT(*fptr)(A, B, C, D, E))
  735. {
  736. return function_ptr<RT, A, B, C, D, E>(fptr);
  737. }
  738. ///////////////////////////////////////////////////////////////////////////////
  739. //
  740. // Function pointer binder (specialization for 6 args)
  741. //
  742. ///////////////////////////////////////////////////////////////////////////////
  743. template <typename RT,
  744. typename A, typename B, typename C, typename D, typename E,
  745. typename F
  746. >
  747. struct function_ptr_action<RT,
  748. A, B, C, D, E, F,
  749. #if PHOENIX_LIMIT > 6
  750. nil_t, nil_t, nil_t,
  751. #if PHOENIX_LIMIT > 9
  752. nil_t, nil_t, nil_t,
  753. #if PHOENIX_LIMIT > 12
  754. nil_t, nil_t, nil_t,
  755. #endif
  756. #endif
  757. #endif
  758. nil_t // Unused
  759. > {
  760. typedef RT result_type;
  761. typedef RT(*func_ptr_t)(A, B, C, D, E, F);
  762. template <
  763. typename A_, typename B_, typename C_, typename D_, typename E_,
  764. typename F_
  765. >
  766. struct result { typedef result_type type; };
  767. function_ptr_action(func_ptr_t fptr_)
  768. : fptr(fptr_) {}
  769. result_type operator()(
  770. A a, B b, C c, D d, E e,
  771. F f
  772. ) const
  773. { return fptr(a, b, c, d, e, f); }
  774. func_ptr_t fptr;
  775. };
  776. //////////////////////////////////
  777. template <typename RT,
  778. typename A, typename B, typename C, typename D, typename E,
  779. typename F
  780. >
  781. inline function_ptr<RT, A, B, C, D, E, F>
  782. bind(RT(*fptr)(A, B, C, D, E, F))
  783. {
  784. return function_ptr<RT, A, B, C, D, E, F>(fptr);
  785. }
  786. #if PHOENIX_LIMIT > 6
  787. ///////////////////////////////////////////////////////////////////////////////
  788. //
  789. // Function pointer binder (specialization for 7 args)
  790. //
  791. ///////////////////////////////////////////////////////////////////////////////
  792. template <typename RT,
  793. typename A, typename B, typename C, typename D, typename E,
  794. typename F, typename G
  795. >
  796. struct function_ptr_action<RT,
  797. A, B, C, D, E, F, G, nil_t, nil_t,
  798. #if PHOENIX_LIMIT > 9
  799. nil_t, nil_t, nil_t,
  800. #if PHOENIX_LIMIT > 12
  801. nil_t, nil_t, nil_t,
  802. #endif
  803. #endif
  804. nil_t // Unused
  805. > {
  806. typedef RT result_type;
  807. typedef RT(*func_ptr_t)(A, B, C, D, E, F, G);
  808. template <
  809. typename A_, typename B_, typename C_, typename D_, typename E_,
  810. typename F_, typename G_
  811. >
  812. struct result { typedef result_type type; };
  813. function_ptr_action(func_ptr_t fptr_)
  814. : fptr(fptr_) {}
  815. result_type operator()(
  816. A a, B b, C c, D d, E e,
  817. F f, G g
  818. ) const
  819. { return fptr(a, b, c, d, e, f, g); }
  820. func_ptr_t fptr;
  821. };
  822. //////////////////////////////////
  823. template <typename RT,
  824. typename A, typename B, typename C, typename D, typename E,
  825. typename F, typename G
  826. >
  827. inline function_ptr<RT, A, B, C, D, E, F, G>
  828. bind(RT(*fptr)(A, B, C, D, E, F, G))
  829. {
  830. return function_ptr<RT, A, B, C, D, E, F, G>(fptr);
  831. }
  832. ///////////////////////////////////////////////////////////////////////////////
  833. //
  834. // Function pointer binder (specialization for 8 args)
  835. //
  836. ///////////////////////////////////////////////////////////////////////////////
  837. template <typename RT,
  838. typename A, typename B, typename C, typename D, typename E,
  839. typename F, typename G, typename H
  840. >
  841. struct function_ptr_action<RT,
  842. A, B, C, D, E, F, G, H, nil_t,
  843. #if PHOENIX_LIMIT > 9
  844. nil_t, nil_t, nil_t,
  845. #if PHOENIX_LIMIT > 12
  846. nil_t, nil_t, nil_t,
  847. #endif
  848. #endif
  849. nil_t // Unused
  850. > {
  851. typedef RT result_type;
  852. typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H);
  853. template <
  854. typename A_, typename B_, typename C_, typename D_, typename E_,
  855. typename F_, typename G_, typename H_
  856. >
  857. struct result { typedef result_type type; };
  858. function_ptr_action(func_ptr_t fptr_)
  859. : fptr(fptr_) {}
  860. result_type operator()(
  861. A a, B b, C c, D d, E e,
  862. F f, G g, H h
  863. ) const
  864. { return fptr(a, b, c, d, e, f, g, h); }
  865. func_ptr_t fptr;
  866. };
  867. //////////////////////////////////
  868. template <typename RT,
  869. typename A, typename B, typename C, typename D, typename E,
  870. typename F, typename G, typename H
  871. >
  872. inline function_ptr<RT, A, B, C, D, E, F, G, H>
  873. bind(RT(*fptr)(A, B, C, D, E, F, G, H))
  874. {
  875. return function_ptr<RT, A, B, C, D, E, F, G, H>(fptr);
  876. }
  877. ///////////////////////////////////////////////////////////////////////////////
  878. //
  879. // Function pointer binder (specialization for 9 args)
  880. //
  881. ///////////////////////////////////////////////////////////////////////////////
  882. template <typename RT,
  883. typename A, typename B, typename C, typename D, typename E,
  884. typename F, typename G, typename H, typename I
  885. >
  886. struct function_ptr_action<RT,
  887. A, B, C, D, E, F, G, H, I,
  888. #if PHOENIX_LIMIT > 9
  889. nil_t, nil_t, nil_t,
  890. #if PHOENIX_LIMIT > 12
  891. nil_t, nil_t, nil_t,
  892. #endif
  893. #endif
  894. nil_t // Unused
  895. > {
  896. typedef RT result_type;
  897. typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I);
  898. template <
  899. typename A_, typename B_, typename C_, typename D_, typename E_,
  900. typename F_, typename G_, typename H_, typename I_
  901. >
  902. struct result { typedef result_type type; };
  903. function_ptr_action(func_ptr_t fptr_)
  904. : fptr(fptr_) {}
  905. result_type operator()(
  906. A a, B b, C c, D d, E e,
  907. F f, G g, H h, I i
  908. ) const
  909. { return fptr(a, b, c, d, e, f, g, h, i); }
  910. func_ptr_t fptr;
  911. };
  912. //////////////////////////////////
  913. template <typename RT,
  914. typename A, typename B, typename C, typename D, typename E,
  915. typename F, typename G, typename H, typename I
  916. >
  917. inline function_ptr<RT, A, B, C, D, E, F, G, H, I>
  918. bind(RT(*fptr)(A, B, C, D, E, F, G, H, I))
  919. {
  920. return function_ptr<RT, A, B, C, D, E, F, G, H, I>(fptr);
  921. }
  922. #if PHOENIX_LIMIT > 9
  923. ///////////////////////////////////////////////////////////////////////////////
  924. //
  925. // Function pointer binder (specialization for 10 args)
  926. //
  927. ///////////////////////////////////////////////////////////////////////////////
  928. template <typename RT,
  929. typename A, typename B, typename C, typename D, typename E,
  930. typename F, typename G, typename H, typename I, typename J
  931. >
  932. struct function_ptr_action<RT,
  933. A, B, C, D, E, F, G, H, I, J, nil_t, nil_t,
  934. #if PHOENIX_LIMIT > 12
  935. nil_t, nil_t, nil_t,
  936. #endif
  937. nil_t // Unused
  938. > {
  939. typedef RT result_type;
  940. typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J);
  941. template <
  942. typename A_, typename B_, typename C_, typename D_, typename E_,
  943. typename F_, typename G_, typename H_, typename I_, typename J_
  944. >
  945. struct result { typedef result_type type; };
  946. function_ptr_action(func_ptr_t fptr_)
  947. : fptr(fptr_) {}
  948. result_type operator()(
  949. A a, B b, C c, D d, E e,
  950. F f, G g, H h, I i, J j
  951. ) const
  952. { return fptr(a, b, c, d, e, f, g, h, i, j); }
  953. func_ptr_t fptr;
  954. };
  955. //////////////////////////////////
  956. template <typename RT,
  957. typename A, typename B, typename C, typename D, typename E,
  958. typename F, typename G, typename H, typename I, typename J
  959. >
  960. inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J>
  961. bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J))
  962. {
  963. return function_ptr<RT, A, B, C, D, E, F, G, H, I, J>(fptr);
  964. }
  965. ///////////////////////////////////////////////////////////////////////////////
  966. //
  967. // Function pointer binder (specialization for 11 args)
  968. //
  969. ///////////////////////////////////////////////////////////////////////////////
  970. template <typename RT,
  971. typename A, typename B, typename C, typename D, typename E,
  972. typename F, typename G, typename H, typename I, typename J,
  973. typename K
  974. >
  975. struct function_ptr_action<RT,
  976. A, B, C, D, E, F, G, H, I, J, K, nil_t,
  977. #if PHOENIX_LIMIT > 12
  978. nil_t, nil_t, nil_t,
  979. #endif
  980. nil_t // Unused
  981. > {
  982. typedef RT result_type;
  983. typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K);
  984. template <
  985. typename A_, typename B_, typename C_, typename D_, typename E_,
  986. typename F_, typename G_, typename H_, typename I_, typename J_,
  987. typename K_
  988. >
  989. struct result { typedef result_type type; };
  990. function_ptr_action(func_ptr_t fptr_)
  991. : fptr(fptr_) {}
  992. result_type operator()(
  993. A a, B b, C c, D d, E e,
  994. F f, G g, H h, I i, J j,
  995. K k
  996. ) const
  997. { return fptr(a, b, c, d, e, f, g, h, i, j, k); }
  998. func_ptr_t fptr;
  999. };
  1000. //////////////////////////////////
  1001. template <typename RT,
  1002. typename A, typename B, typename C, typename D, typename E,
  1003. typename F, typename G, typename H, typename I, typename J,
  1004. typename K
  1005. >
  1006. inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K>
  1007. bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K))
  1008. {
  1009. return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K>(fptr);
  1010. }
  1011. ///////////////////////////////////////////////////////////////////////////////
  1012. //
  1013. // Function pointer binder (specialization for 12 args)
  1014. //
  1015. ///////////////////////////////////////////////////////////////////////////////
  1016. template <typename RT,
  1017. typename A, typename B, typename C, typename D, typename E,
  1018. typename F, typename G, typename H, typename I, typename J,
  1019. typename K, typename L
  1020. >
  1021. struct function_ptr_action<RT,
  1022. A, B, C, D, E, F, G, H, I, J, K, L,
  1023. #if PHOENIX_LIMIT > 12
  1024. nil_t, nil_t, nil_t,
  1025. #endif
  1026. nil_t // Unused
  1027. > {
  1028. typedef RT result_type;
  1029. typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K, L);
  1030. template <
  1031. typename A_, typename B_, typename C_, typename D_, typename E_,
  1032. typename F_, typename G_, typename H_, typename I_, typename J_,
  1033. typename K_, typename L_
  1034. >
  1035. struct result { typedef result_type type; };
  1036. function_ptr_action(func_ptr_t fptr_)
  1037. : fptr(fptr_) {}
  1038. result_type operator()(
  1039. A a, B b, C c, D d, E e,
  1040. F f, G g, H h, I i, J j,
  1041. K k, L l
  1042. ) const
  1043. { return fptr(a, b, c, d, e, f, g, h, i, j, k, l); }
  1044. func_ptr_t fptr;
  1045. };
  1046. //////////////////////////////////
  1047. template <typename RT,
  1048. typename A, typename B, typename C, typename D, typename E,
  1049. typename F, typename G, typename H, typename I, typename J,
  1050. typename K, typename L
  1051. >
  1052. inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L>
  1053. bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K, L))
  1054. {
  1055. return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L>(fptr);
  1056. }
  1057. #if PHOENIX_LIMIT > 12
  1058. ///////////////////////////////////////////////////////////////////////////////
  1059. //
  1060. // Function pointer binder (specialization for 13 args)
  1061. //
  1062. ///////////////////////////////////////////////////////////////////////////////
  1063. template <typename RT,
  1064. typename A, typename B, typename C, typename D, typename E,
  1065. typename F, typename G, typename H, typename I, typename J,
  1066. typename K, typename L, typename M
  1067. >
  1068. struct function_ptr_action<RT,
  1069. A, B, C, D, E, F, G, H, I, J, K, L, M, nil_t, nil_t, nil_t> {
  1070. typedef RT result_type;
  1071. typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K, L, M);
  1072. template <
  1073. typename A_, typename B_, typename C_, typename D_, typename E_,
  1074. typename F_, typename G_, typename H_, typename I_, typename J_,
  1075. typename K_, typename L_, typename M_
  1076. >
  1077. struct result { typedef result_type type; };
  1078. function_ptr_action(func_ptr_t fptr_)
  1079. : fptr(fptr_) {}
  1080. result_type operator()(
  1081. A a, B b, C c, D d, E e,
  1082. F f, G g, H h, I i, J j,
  1083. K k, L l, M m
  1084. ) const
  1085. { return fptr(a, b, c, d, e, f, g, h, i, j, k, l, m); }
  1086. func_ptr_t fptr;
  1087. };
  1088. //////////////////////////////////
  1089. template <typename RT,
  1090. typename A, typename B, typename C, typename D, typename E,
  1091. typename F, typename G, typename H, typename I, typename J,
  1092. typename K, typename L, typename M
  1093. >
  1094. inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M>
  1095. bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M))
  1096. {
  1097. return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M>(fptr);
  1098. }
  1099. ///////////////////////////////////////////////////////////////////////////////
  1100. //
  1101. // Function pointer binder (specialization for 14 args)
  1102. //
  1103. ///////////////////////////////////////////////////////////////////////////////
  1104. template <typename RT,
  1105. typename A, typename B, typename C, typename D, typename E,
  1106. typename F, typename G, typename H, typename I, typename J,
  1107. typename K, typename L, typename M, typename N
  1108. >
  1109. struct function_ptr_action<RT,
  1110. A, B, C, D, E, F, G, H, I, J, K, L, M, N, nil_t, nil_t> {
  1111. typedef RT result_type;
  1112. typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K, L, M, N);
  1113. template <
  1114. typename A_, typename B_, typename C_, typename D_, typename E_,
  1115. typename F_, typename G_, typename H_, typename I_, typename J_,
  1116. typename K_, typename L_, typename M_, typename N_
  1117. >
  1118. struct result { typedef result_type type; };
  1119. function_ptr_action(func_ptr_t fptr_)
  1120. : fptr(fptr_) {}
  1121. result_type operator()(
  1122. A a, B b, C c, D d, E e,
  1123. F f, G g, H h, I i, J j,
  1124. K k, L l, M m, N n
  1125. ) const
  1126. { return fptr(a, b, c, d, e, f, g, h, i, j, k, l, m, n); }
  1127. func_ptr_t fptr;
  1128. };
  1129. //////////////////////////////////
  1130. template <typename RT,
  1131. typename A, typename B, typename C, typename D, typename E,
  1132. typename F, typename G, typename H, typename I, typename J,
  1133. typename K, typename L, typename M, typename N
  1134. >
  1135. inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>
  1136. bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N))
  1137. {
  1138. return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(fptr);
  1139. }
  1140. ///////////////////////////////////////////////////////////////////////////////
  1141. //
  1142. // Function pointer binder (specialization for 15 args)
  1143. //
  1144. ///////////////////////////////////////////////////////////////////////////////
  1145. template <typename RT,
  1146. typename A, typename B, typename C, typename D, typename E,
  1147. typename F, typename G, typename H, typename I, typename J,
  1148. typename K, typename L, typename M, typename N, typename O
  1149. >
  1150. struct function_ptr_action<RT,
  1151. A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, nil_t> {
  1152. typedef RT result_type;
  1153. typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O);
  1154. template <
  1155. typename A_, typename B_, typename C_, typename D_, typename E_,
  1156. typename F_, typename G_, typename H_, typename I_, typename J_,
  1157. typename K_, typename L_, typename M_, typename N_, typename O_
  1158. >
  1159. struct result { typedef result_type type; };
  1160. function_ptr_action(func_ptr_t fptr_)
  1161. : fptr(fptr_) {}
  1162. result_type operator()(
  1163. A a, B b, C c, D d, E e,
  1164. F f, G g, H h, I i, J j,
  1165. K k, L l, M m, N n, O o
  1166. ) const
  1167. { return fptr(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); }
  1168. func_ptr_t fptr;
  1169. };
  1170. //////////////////////////////////
  1171. template <typename RT,
  1172. typename A, typename B, typename C, typename D, typename E,
  1173. typename F, typename G, typename H, typename I, typename J,
  1174. typename K, typename L, typename M, typename N, typename O
  1175. >
  1176. inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>
  1177. bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O))
  1178. {
  1179. return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(fptr);
  1180. }
  1181. #endif
  1182. #endif
  1183. #endif
  1184. #endif
  1185. ///////////////////////////////////////////////////////////////////////////////
  1186. //
  1187. // Member function pointer binder (main class)
  1188. //
  1189. ///////////////////////////////////////////////////////////////////////////////
  1190. template <
  1191. typename RT,
  1192. typename ClassT
  1193. , typename A = nil_t
  1194. , typename B = nil_t
  1195. , typename C = nil_t
  1196. #if PHOENIX_LIMIT > 3
  1197. , typename D = nil_t
  1198. , typename E = nil_t
  1199. , typename F = nil_t
  1200. #if PHOENIX_LIMIT > 6
  1201. , typename G = nil_t
  1202. , typename H = nil_t
  1203. , typename I = nil_t
  1204. #if PHOENIX_LIMIT > 9
  1205. , typename J = nil_t
  1206. , typename K = nil_t
  1207. , typename L = nil_t
  1208. #if PHOENIX_LIMIT > 12
  1209. , typename M = nil_t
  1210. , typename N = nil_t
  1211. , typename O = nil_t
  1212. #endif
  1213. #endif
  1214. #endif
  1215. #endif
  1216. , typename NU = nil_t // Not used
  1217. >
  1218. struct member_function_ptr_action;
  1219. //////////////////////////////////
  1220. template <
  1221. typename RT,
  1222. typename ClassT
  1223. , typename A = nil_t
  1224. , typename B = nil_t
  1225. , typename C = nil_t
  1226. #if PHOENIX_LIMIT > 3
  1227. , typename D = nil_t
  1228. , typename E = nil_t
  1229. , typename F = nil_t
  1230. #if PHOENIX_LIMIT > 6
  1231. , typename G = nil_t
  1232. , typename H = nil_t
  1233. , typename I = nil_t
  1234. #if PHOENIX_LIMIT > 9
  1235. , typename J = nil_t
  1236. , typename K = nil_t
  1237. , typename L = nil_t
  1238. #if PHOENIX_LIMIT > 12
  1239. , typename M = nil_t
  1240. , typename N = nil_t
  1241. , typename O = nil_t
  1242. #endif
  1243. #endif
  1244. #endif
  1245. #endif
  1246. >
  1247. struct member_function_ptr
  1248. : public function<member_function_ptr_action<RT, ClassT
  1249. , A, B, C
  1250. #if PHOENIX_LIMIT > 3
  1251. , D, E, F
  1252. #if PHOENIX_LIMIT > 6
  1253. , G, H, I
  1254. #if PHOENIX_LIMIT > 9
  1255. , J, K, L
  1256. #if PHOENIX_LIMIT > 12
  1257. , M, N, O
  1258. #endif
  1259. #endif
  1260. #endif
  1261. #endif
  1262. > > {
  1263. typedef member_function_ptr_action<RT, ClassT
  1264. , A, B, C
  1265. #if PHOENIX_LIMIT > 3
  1266. , D, E, F
  1267. #if PHOENIX_LIMIT > 6
  1268. , G, H, I
  1269. #if PHOENIX_LIMIT > 9
  1270. , J, K, L
  1271. #if PHOENIX_LIMIT > 12
  1272. , M, N, O
  1273. #endif
  1274. #endif
  1275. #endif
  1276. #endif
  1277. > action_t;
  1278. template <typename FPT>
  1279. member_function_ptr(FPT fp)
  1280. : function<action_t>(action_t(fp)) {}
  1281. };
  1282. ///////////////////////////////////////////////////////////////////////////////
  1283. //
  1284. // Member function pointer binder (specialization for 0 arg)
  1285. //
  1286. ///////////////////////////////////////////////////////////////////////////////
  1287. template <typename RT, typename ClassT>
  1288. struct member_function_ptr_action<RT, ClassT,
  1289. nil_t, nil_t, nil_t,
  1290. #if PHOENIX_LIMIT > 3
  1291. nil_t, nil_t, nil_t,
  1292. #if PHOENIX_LIMIT > 6
  1293. nil_t, nil_t, nil_t,
  1294. #if PHOENIX_LIMIT > 9
  1295. nil_t, nil_t, nil_t,
  1296. #if PHOENIX_LIMIT > 12
  1297. nil_t, nil_t, nil_t,
  1298. #endif
  1299. #endif
  1300. #endif
  1301. #endif
  1302. nil_t // Unused
  1303. > {
  1304. typedef RT result_type;
  1305. typedef RT(ClassT::*mf)();
  1306. typedef RT(ClassT::*cmf)() const;
  1307. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1308. mem_func_ptr_t;
  1309. template <typename CT>
  1310. struct result { typedef result_type type; };
  1311. member_function_ptr_action(mem_func_ptr_t fptr_)
  1312. : fptr(fptr_) {}
  1313. template <typename CT>
  1314. result_type operator()(CT& obj) const
  1315. { return (impl::as_ptr<CT>::get(obj)->*fptr)(); }
  1316. mem_func_ptr_t fptr;
  1317. };
  1318. //////////////////////////////////
  1319. template <typename RT, typename ClassT>
  1320. inline member_function_ptr<RT, ClassT>
  1321. bind(RT(ClassT::*fptr)())
  1322. {
  1323. return member_function_ptr<RT, ClassT>(fptr);
  1324. }
  1325. template <typename RT, typename ClassT>
  1326. inline member_function_ptr<RT, ClassT const>
  1327. bind(RT(ClassT::*fptr)() const)
  1328. {
  1329. return member_function_ptr<RT, ClassT const>(fptr);
  1330. }
  1331. ///////////////////////////////////////////////////////////////////////////////
  1332. //
  1333. // Member function pointer binder (specialization for 1 arg)
  1334. //
  1335. ///////////////////////////////////////////////////////////////////////////////
  1336. template <typename RT, typename ClassT, typename A>
  1337. struct member_function_ptr_action<RT, ClassT,
  1338. A, nil_t, nil_t,
  1339. #if PHOENIX_LIMIT > 3
  1340. nil_t, nil_t, nil_t,
  1341. #if PHOENIX_LIMIT > 6
  1342. nil_t, nil_t, nil_t,
  1343. #if PHOENIX_LIMIT > 9
  1344. nil_t, nil_t, nil_t,
  1345. #if PHOENIX_LIMIT > 12
  1346. nil_t, nil_t, nil_t,
  1347. #endif
  1348. #endif
  1349. #endif
  1350. #endif
  1351. nil_t // Unused
  1352. > {
  1353. typedef RT result_type;
  1354. typedef RT(ClassT::*mf)(A);
  1355. typedef RT(ClassT::*cmf)(A) const;
  1356. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1357. mem_func_ptr_t;
  1358. template <typename CT, typename A_>
  1359. struct result { typedef result_type type; };
  1360. member_function_ptr_action(mem_func_ptr_t fptr_)
  1361. : fptr(fptr_) {}
  1362. template <typename CT>
  1363. result_type operator()(CT& obj, A a) const
  1364. { return (impl::as_ptr<CT>::get(obj)->*fptr)(a); }
  1365. mem_func_ptr_t fptr;
  1366. };
  1367. //////////////////////////////////
  1368. template <typename RT, typename ClassT, typename A>
  1369. inline member_function_ptr<RT, ClassT, A>
  1370. bind(RT(ClassT::*fptr)(A))
  1371. {
  1372. return member_function_ptr<RT, ClassT, A>(fptr);
  1373. }
  1374. //////////////////////////////////
  1375. template <typename RT, typename ClassT, typename A>
  1376. inline member_function_ptr<RT, ClassT const, A>
  1377. bind(RT(ClassT::*fptr)(A) const)
  1378. {
  1379. return member_function_ptr<RT, ClassT const, A>(fptr);
  1380. }
  1381. ///////////////////////////////////////////////////////////////////////////////
  1382. //
  1383. // Member function pointer binder (specialization for 2 args)
  1384. //
  1385. ///////////////////////////////////////////////////////////////////////////////
  1386. template <typename RT, typename ClassT, typename A, typename B>
  1387. struct member_function_ptr_action<RT, ClassT,
  1388. A, B, nil_t,
  1389. #if PHOENIX_LIMIT > 3
  1390. nil_t, nil_t, nil_t,
  1391. #if PHOENIX_LIMIT > 6
  1392. nil_t, nil_t, nil_t,
  1393. #if PHOENIX_LIMIT > 9
  1394. nil_t, nil_t, nil_t,
  1395. #if PHOENIX_LIMIT > 12
  1396. nil_t, nil_t, nil_t,
  1397. #endif
  1398. #endif
  1399. #endif
  1400. #endif
  1401. nil_t // Unused
  1402. > {
  1403. typedef RT result_type;
  1404. typedef RT(ClassT::*mf)(A, B);
  1405. typedef RT(ClassT::*cmf)(A, B) const;
  1406. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1407. mem_func_ptr_t;
  1408. template <typename CT, typename A_, typename B_>
  1409. struct result { typedef result_type type; };
  1410. member_function_ptr_action(mem_func_ptr_t fptr_)
  1411. : fptr(fptr_) {}
  1412. template <typename CT>
  1413. result_type operator()(CT& obj, A a, B b) const
  1414. { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b); }
  1415. mem_func_ptr_t fptr;
  1416. };
  1417. //////////////////////////////////
  1418. template <typename RT, typename ClassT, typename A, typename B>
  1419. inline member_function_ptr<RT, ClassT, A, B>
  1420. bind(RT(ClassT::*fptr)(A, B))
  1421. {
  1422. return member_function_ptr<RT, ClassT, A, B>(fptr);
  1423. }
  1424. //////////////////////////////////
  1425. template <typename RT, typename ClassT, typename A, typename B>
  1426. inline member_function_ptr<RT, ClassT const, A, B>
  1427. bind(RT(ClassT::*fptr)(A, B) const)
  1428. {
  1429. return member_function_ptr<RT, ClassT const, A, B>(fptr);
  1430. }
  1431. #if PHOENIX_LIMIT > 3
  1432. ///////////////////////////////////////////////////////////////////////////////
  1433. //
  1434. // Member function pointer binder (specialization for 3 args)
  1435. //
  1436. ///////////////////////////////////////////////////////////////////////////////
  1437. template <typename RT, typename ClassT, typename A, typename B, typename C>
  1438. struct member_function_ptr_action<RT, ClassT,
  1439. A, B, C, nil_t, nil_t, nil_t,
  1440. #if PHOENIX_LIMIT > 6
  1441. nil_t, nil_t, nil_t,
  1442. #if PHOENIX_LIMIT > 9
  1443. nil_t, nil_t, nil_t,
  1444. #if PHOENIX_LIMIT > 12
  1445. nil_t, nil_t, nil_t,
  1446. #endif
  1447. #endif
  1448. #endif
  1449. nil_t // Unused
  1450. > {
  1451. typedef RT result_type;
  1452. typedef RT(ClassT::*mf)(A, B, C);
  1453. typedef RT(ClassT::*cmf)(A, B, C) const;
  1454. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1455. mem_func_ptr_t;
  1456. template <typename CT, typename A_, typename B_, typename C_>
  1457. struct result { typedef result_type type; };
  1458. member_function_ptr_action(mem_func_ptr_t fptr_)
  1459. : fptr(fptr_) {}
  1460. template <typename CT>
  1461. result_type operator()(CT& obj, A a, B b, C c) const
  1462. { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c); }
  1463. mem_func_ptr_t fptr;
  1464. };
  1465. //////////////////////////////////
  1466. template <typename RT, typename ClassT, typename A, typename B, typename C>
  1467. inline member_function_ptr<RT, ClassT, A, B, C>
  1468. bind(RT(ClassT::*fptr)(A, B, C))
  1469. {
  1470. return member_function_ptr<RT, ClassT, A, B, C>(fptr);
  1471. }
  1472. //////////////////////////////////
  1473. template <typename RT, typename ClassT, typename A, typename B, typename C>
  1474. inline member_function_ptr<RT, ClassT const, A, B, C>
  1475. bind(RT(ClassT::*fptr)(A, B, C) const)
  1476. {
  1477. return member_function_ptr<RT, ClassT const, A, B, C>(fptr);
  1478. }
  1479. ///////////////////////////////////////////////////////////////////////////////
  1480. //
  1481. // Member function pointer binder (specialization for 4 args)
  1482. //
  1483. ///////////////////////////////////////////////////////////////////////////////
  1484. template <typename RT, typename ClassT,
  1485. typename A, typename B, typename C, typename D
  1486. >
  1487. struct member_function_ptr_action<RT, ClassT,
  1488. A, B, C, D, nil_t, nil_t,
  1489. #if PHOENIX_LIMIT > 6
  1490. nil_t, nil_t, nil_t,
  1491. #if PHOENIX_LIMIT > 9
  1492. nil_t, nil_t, nil_t,
  1493. #if PHOENIX_LIMIT > 12
  1494. nil_t, nil_t, nil_t,
  1495. #endif
  1496. #endif
  1497. #endif
  1498. nil_t // Unused
  1499. > {
  1500. typedef RT result_type;
  1501. typedef RT(ClassT::*mf)(A, B, C, D);
  1502. typedef RT(ClassT::*cmf)(A, B, C, D) const;
  1503. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1504. mem_func_ptr_t;
  1505. template <typename CT,
  1506. typename A_, typename B_, typename C_, typename D_
  1507. >
  1508. struct result { typedef result_type type; };
  1509. member_function_ptr_action(mem_func_ptr_t fptr_)
  1510. : fptr(fptr_) {}
  1511. template <typename CT>
  1512. result_type operator()(CT& obj,
  1513. A a, B b, C c, D d
  1514. ) const
  1515. { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d); }
  1516. mem_func_ptr_t fptr;
  1517. };
  1518. //////////////////////////////////
  1519. template <typename RT, typename ClassT,
  1520. typename A, typename B, typename C, typename D
  1521. >
  1522. inline member_function_ptr<RT, ClassT, A, B, C, D>
  1523. bind(RT(ClassT::*fptr)(A, B, C, D))
  1524. {
  1525. return member_function_ptr<
  1526. RT, ClassT, A, B, C, D>(fptr);
  1527. }
  1528. //////////////////////////////////
  1529. template <typename RT, typename ClassT,
  1530. typename A, typename B, typename C, typename D
  1531. >
  1532. inline member_function_ptr<RT, ClassT const, A, B, C, D>
  1533. bind(RT(ClassT::*fptr)(A, B, C, D) const)
  1534. {
  1535. return member_function_ptr<
  1536. RT, ClassT const, A, B, C, D>(fptr);
  1537. }
  1538. ///////////////////////////////////////////////////////////////////////////////
  1539. //
  1540. // Member function pointer binder (specialization for 5 args)
  1541. //
  1542. ///////////////////////////////////////////////////////////////////////////////
  1543. template <typename RT, typename ClassT,
  1544. typename A, typename B, typename C, typename D,
  1545. typename E
  1546. >
  1547. struct member_function_ptr_action<RT, ClassT,
  1548. A, B, C, D, E, nil_t,
  1549. #if PHOENIX_LIMIT > 6
  1550. nil_t, nil_t, nil_t,
  1551. #if PHOENIX_LIMIT > 9
  1552. nil_t, nil_t, nil_t,
  1553. #if PHOENIX_LIMIT > 12
  1554. nil_t, nil_t, nil_t,
  1555. #endif
  1556. #endif
  1557. #endif
  1558. nil_t // Unused
  1559. > {
  1560. typedef RT result_type;
  1561. typedef RT(ClassT::*mf)(A, B, C, D, E);
  1562. typedef RT(ClassT::*cmf)(A, B, C, D, E) const;
  1563. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1564. mem_func_ptr_t;
  1565. template <typename CT,
  1566. typename A_, typename B_, typename C_, typename D_,
  1567. typename E_
  1568. >
  1569. struct result { typedef result_type type; };
  1570. member_function_ptr_action(mem_func_ptr_t fptr_)
  1571. : fptr(fptr_) {}
  1572. template <typename CT>
  1573. result_type operator()(CT& obj,
  1574. A a, B b, C c, D d, E e
  1575. ) const
  1576. { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e); }
  1577. mem_func_ptr_t fptr;
  1578. };
  1579. //////////////////////////////////
  1580. template <typename RT, typename ClassT,
  1581. typename A, typename B, typename C, typename D,
  1582. typename E
  1583. >
  1584. inline member_function_ptr<RT, ClassT, A, B, C, D, E>
  1585. bind(RT(ClassT::*fptr)(A, B, C, D, E))
  1586. {
  1587. return member_function_ptr<
  1588. RT, ClassT, A, B, C, D, E>(fptr);
  1589. }
  1590. //////////////////////////////////
  1591. template <typename RT, typename ClassT,
  1592. typename A, typename B, typename C, typename D,
  1593. typename E
  1594. >
  1595. inline member_function_ptr<RT, ClassT const, A, B, C, D, E>
  1596. bind(RT(ClassT::*fptr)(A, B, C, D, E) const)
  1597. {
  1598. return member_function_ptr<
  1599. RT, ClassT const, A, B, C, D, E>(fptr);
  1600. }
  1601. #if PHOENIX_LIMIT > 6
  1602. ///////////////////////////////////////////////////////////////////////////////
  1603. //
  1604. // Member function pointer binder (specialization for 6 args)
  1605. //
  1606. ///////////////////////////////////////////////////////////////////////////////
  1607. template <typename RT, typename ClassT,
  1608. typename A, typename B, typename C, typename D,
  1609. typename E, typename F
  1610. >
  1611. struct member_function_ptr_action<RT, ClassT,
  1612. A, B, C, D, E, F, nil_t, nil_t, nil_t,
  1613. #if PHOENIX_LIMIT > 9
  1614. nil_t, nil_t, nil_t,
  1615. #if PHOENIX_LIMIT > 12
  1616. nil_t, nil_t, nil_t,
  1617. #endif
  1618. #endif
  1619. nil_t // Unused
  1620. > {
  1621. typedef RT result_type;
  1622. typedef RT(ClassT::*mf)(A, B, C, D, E, F);
  1623. typedef RT(ClassT::*cmf)(A, B, C, D, E, F) const;
  1624. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1625. mem_func_ptr_t;
  1626. template <typename CT,
  1627. typename A_, typename B_, typename C_, typename D_,
  1628. typename E_, typename F_
  1629. >
  1630. struct result { typedef result_type type; };
  1631. member_function_ptr_action(mem_func_ptr_t fptr_)
  1632. : fptr(fptr_) {}
  1633. template <typename CT>
  1634. result_type operator()(CT& obj,
  1635. A a, B b, C c, D d, E e, F f
  1636. ) const
  1637. { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e, f); }
  1638. mem_func_ptr_t fptr;
  1639. };
  1640. //////////////////////////////////
  1641. template <typename RT, typename ClassT,
  1642. typename A, typename B, typename C, typename D,
  1643. typename E, typename F
  1644. >
  1645. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F>
  1646. bind(RT(ClassT::*fptr)(A, B, C, D, E, F))
  1647. {
  1648. return member_function_ptr<
  1649. RT, ClassT, A, B, C, D, E, F>(fptr);
  1650. }
  1651. //////////////////////////////////
  1652. template <typename RT, typename ClassT,
  1653. typename A, typename B, typename C, typename D,
  1654. typename E, typename F
  1655. >
  1656. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F>
  1657. bind(RT(ClassT::*fptr)(A, B, C, D, E, F) const)
  1658. {
  1659. return member_function_ptr<
  1660. RT, ClassT const, A, B, C, D, E, F>(fptr);
  1661. }
  1662. ///////////////////////////////////////////////////////////////////////////////
  1663. //
  1664. // Member function pointer binder (specialization for 7 args)
  1665. //
  1666. ///////////////////////////////////////////////////////////////////////////////
  1667. template <typename RT, typename ClassT,
  1668. typename A, typename B, typename C, typename D,
  1669. typename E, typename F, typename G
  1670. >
  1671. struct member_function_ptr_action<RT, ClassT,
  1672. A, B, C, D, E, F, G, nil_t, nil_t,
  1673. #if PHOENIX_LIMIT > 9
  1674. nil_t, nil_t, nil_t,
  1675. #if PHOENIX_LIMIT > 12
  1676. nil_t, nil_t, nil_t,
  1677. #endif
  1678. #endif
  1679. nil_t // Unused
  1680. > {
  1681. typedef RT result_type;
  1682. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G);
  1683. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G) const;
  1684. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1685. mem_func_ptr_t;
  1686. template <typename CT,
  1687. typename A_, typename B_, typename C_, typename D_,
  1688. typename E_, typename F_, typename G_
  1689. >
  1690. struct result { typedef result_type type; };
  1691. member_function_ptr_action(mem_func_ptr_t fptr_)
  1692. : fptr(fptr_) {}
  1693. template <typename CT>
  1694. result_type operator()(CT& obj,
  1695. A a, B b, C c, D d, E e, F f, G g
  1696. ) const
  1697. { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e, f, g); }
  1698. mem_func_ptr_t fptr;
  1699. };
  1700. //////////////////////////////////
  1701. template <typename RT, typename ClassT,
  1702. typename A, typename B, typename C, typename D,
  1703. typename E, typename F, typename G
  1704. >
  1705. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G>
  1706. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G))
  1707. {
  1708. return member_function_ptr<
  1709. RT, ClassT, A, B, C, D, E, F, G>(fptr);
  1710. }
  1711. //////////////////////////////////
  1712. template <typename RT, typename ClassT,
  1713. typename A, typename B, typename C, typename D,
  1714. typename E, typename F, typename G
  1715. >
  1716. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G>
  1717. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G) const)
  1718. {
  1719. return member_function_ptr<
  1720. RT, ClassT const, A, B, C, D, E, F, G>(fptr);
  1721. }
  1722. ///////////////////////////////////////////////////////////////////////////////
  1723. //
  1724. // Member function pointer binder (specialization for 8 args)
  1725. //
  1726. ///////////////////////////////////////////////////////////////////////////////
  1727. template <typename RT, typename ClassT,
  1728. typename A, typename B, typename C, typename D,
  1729. typename E, typename F, typename G, typename H
  1730. >
  1731. struct member_function_ptr_action<RT, ClassT,
  1732. A, B, C, D, E, F, G, H, nil_t,
  1733. #if PHOENIX_LIMIT > 9
  1734. nil_t, nil_t, nil_t,
  1735. #if PHOENIX_LIMIT > 12
  1736. nil_t, nil_t, nil_t,
  1737. #endif
  1738. #endif
  1739. nil_t // Unused
  1740. > {
  1741. typedef RT result_type;
  1742. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H);
  1743. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H) const;
  1744. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1745. mem_func_ptr_t;
  1746. template <typename CT,
  1747. typename A_, typename B_, typename C_, typename D_,
  1748. typename E_, typename F_, typename G_, typename H_
  1749. >
  1750. struct result { typedef result_type type; };
  1751. member_function_ptr_action(mem_func_ptr_t fptr_)
  1752. : fptr(fptr_) {}
  1753. template <typename CT>
  1754. result_type operator()(CT& obj,
  1755. A a, B b, C c, D d, E e, F f, G g, H h
  1756. ) const
  1757. { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e, f, g, h); }
  1758. mem_func_ptr_t fptr;
  1759. };
  1760. //////////////////////////////////
  1761. template <typename RT, typename ClassT,
  1762. typename A, typename B, typename C, typename D,
  1763. typename E, typename F, typename G, typename H
  1764. >
  1765. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H>
  1766. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H))
  1767. {
  1768. return member_function_ptr<
  1769. RT, ClassT, A, B, C, D, E, F, G, H>(fptr);
  1770. }
  1771. //////////////////////////////////
  1772. template <typename RT, typename ClassT,
  1773. typename A, typename B, typename C, typename D,
  1774. typename E, typename F, typename G, typename H
  1775. >
  1776. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H>
  1777. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H) const)
  1778. {
  1779. return member_function_ptr<
  1780. RT, ClassT const, A, B, C, D, E, F, G, H>(fptr);
  1781. }
  1782. #if PHOENIX_LIMIT > 9
  1783. ///////////////////////////////////////////////////////////////////////////////
  1784. //
  1785. // Member function pointer binder (specialization for 9 args)
  1786. //
  1787. ///////////////////////////////////////////////////////////////////////////////
  1788. template <typename RT, typename ClassT,
  1789. typename A, typename B, typename C, typename D,
  1790. typename E, typename F, typename G, typename H, typename I
  1791. >
  1792. struct member_function_ptr_action<RT, ClassT,
  1793. A, B, C, D, E, F, G, H, I, nil_t, nil_t, nil_t,
  1794. #if PHOENIX_LIMIT > 12
  1795. nil_t, nil_t, nil_t,
  1796. #endif
  1797. nil_t // Unused
  1798. > {
  1799. typedef RT result_type;
  1800. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I);
  1801. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I) const;
  1802. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1803. mem_func_ptr_t;
  1804. template <typename CT,
  1805. typename A_, typename B_, typename C_, typename D_,
  1806. typename E_, typename F_, typename G_, typename H_, typename I_
  1807. >
  1808. struct result { typedef result_type type; };
  1809. member_function_ptr_action(mem_func_ptr_t fptr_)
  1810. : fptr(fptr_) {}
  1811. template <typename CT>
  1812. result_type operator()(CT& obj,
  1813. A a, B b, C c, D d, E e, F f, G g, H h, I i
  1814. ) const
  1815. { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e, f, g, h, i); }
  1816. mem_func_ptr_t fptr;
  1817. };
  1818. //////////////////////////////////
  1819. template <typename RT, typename ClassT,
  1820. typename A, typename B, typename C, typename D,
  1821. typename E, typename F, typename G, typename H, typename I
  1822. >
  1823. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I>
  1824. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I))
  1825. {
  1826. return member_function_ptr<
  1827. RT, ClassT, A, B, C, D, E, F, G, H, I>(fptr);
  1828. }
  1829. //////////////////////////////////
  1830. template <typename RT, typename ClassT,
  1831. typename A, typename B, typename C, typename D,
  1832. typename E, typename F, typename G, typename H, typename I
  1833. >
  1834. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I>
  1835. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I) const)
  1836. {
  1837. return member_function_ptr<
  1838. RT, ClassT const, A, B, C, D, E, F, G, H, I>(fptr);
  1839. }
  1840. ///////////////////////////////////////////////////////////////////////////////
  1841. //
  1842. // Member function pointer binder (specialization for 10 args)
  1843. //
  1844. ///////////////////////////////////////////////////////////////////////////////
  1845. template <typename RT, typename ClassT,
  1846. typename A, typename B, typename C, typename D,
  1847. typename E, typename F, typename G, typename H, typename I,
  1848. typename J
  1849. >
  1850. struct member_function_ptr_action<RT, ClassT,
  1851. A, B, C, D, E, F, G, H, I, J, nil_t, nil_t,
  1852. #if PHOENIX_LIMIT > 12
  1853. nil_t, nil_t, nil_t,
  1854. #endif
  1855. nil_t // Unused
  1856. > {
  1857. typedef RT result_type;
  1858. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J);
  1859. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J) const;
  1860. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1861. mem_func_ptr_t;
  1862. template <typename CT,
  1863. typename A_, typename B_, typename C_, typename D_,
  1864. typename E_, typename F_, typename G_, typename H_, typename I_,
  1865. typename J_
  1866. >
  1867. struct result { typedef result_type type; };
  1868. member_function_ptr_action(mem_func_ptr_t fptr_)
  1869. : fptr(fptr_) {}
  1870. template <typename CT>
  1871. result_type operator()(CT& obj,
  1872. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j
  1873. ) const
  1874. {
  1875. return (impl::as_ptr<CT>::get(obj)->*fptr)
  1876. (a, b, c, d, e, f, g, h, i, j);
  1877. }
  1878. mem_func_ptr_t fptr;
  1879. };
  1880. //////////////////////////////////
  1881. template <typename RT, typename ClassT,
  1882. typename A, typename B, typename C, typename D,
  1883. typename E, typename F, typename G, typename H, typename I,
  1884. typename J
  1885. >
  1886. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J>
  1887. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J))
  1888. {
  1889. return member_function_ptr<
  1890. RT, ClassT, A, B, C, D, E, F, G, H, I, J>(fptr);
  1891. }
  1892. //////////////////////////////////
  1893. template <typename RT, typename ClassT,
  1894. typename A, typename B, typename C, typename D,
  1895. typename E, typename F, typename G, typename H, typename I,
  1896. typename J
  1897. >
  1898. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J>
  1899. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J) const)
  1900. {
  1901. return member_function_ptr<
  1902. RT, ClassT const, A, B, C, D, E, F, G, H, I, J>(fptr);
  1903. }
  1904. ///////////////////////////////////////////////////////////////////////////////
  1905. //
  1906. // Member function pointer binder (specialization for 11 args)
  1907. //
  1908. ///////////////////////////////////////////////////////////////////////////////
  1909. template <typename RT, typename ClassT,
  1910. typename A, typename B, typename C, typename D,
  1911. typename E, typename F, typename G, typename H, typename I,
  1912. typename J, typename K
  1913. >
  1914. struct member_function_ptr_action<RT, ClassT,
  1915. A, B, C, D, E, F, G, H, I, J, K, nil_t,
  1916. #if PHOENIX_LIMIT > 12
  1917. nil_t, nil_t, nil_t,
  1918. #endif
  1919. nil_t // Unused
  1920. > {
  1921. typedef RT result_type;
  1922. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K);
  1923. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K) const;
  1924. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1925. mem_func_ptr_t;
  1926. template <typename CT,
  1927. typename A_, typename B_, typename C_, typename D_,
  1928. typename E_, typename F_, typename G_, typename H_, typename I_,
  1929. typename J_, typename K_
  1930. >
  1931. struct result { typedef result_type type; };
  1932. member_function_ptr_action(mem_func_ptr_t fptr_)
  1933. : fptr(fptr_) {}
  1934. template <typename CT>
  1935. result_type operator()(CT& obj,
  1936. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k
  1937. ) const
  1938. {
  1939. return (impl::as_ptr<CT>::get(obj)->*fptr)
  1940. (a, b, c, d, e, f, g, h, i, j, k);
  1941. }
  1942. mem_func_ptr_t fptr;
  1943. };
  1944. //////////////////////////////////
  1945. template <typename RT, typename ClassT,
  1946. typename A, typename B, typename C, typename D,
  1947. typename E, typename F, typename G, typename H, typename I,
  1948. typename J, typename K
  1949. >
  1950. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K>
  1951. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K))
  1952. {
  1953. return member_function_ptr<
  1954. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K>(fptr);
  1955. }
  1956. //////////////////////////////////
  1957. template <typename RT, typename ClassT,
  1958. typename A, typename B, typename C, typename D,
  1959. typename E, typename F, typename G, typename H, typename I,
  1960. typename J, typename K
  1961. >
  1962. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K>
  1963. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K) const)
  1964. {
  1965. return member_function_ptr<
  1966. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K>(fptr);
  1967. }
  1968. #if PHOENIX_LIMIT > 12
  1969. ///////////////////////////////////////////////////////////////////////////////
  1970. //
  1971. // Member function pointer binder (specialization for 12 args)
  1972. //
  1973. ///////////////////////////////////////////////////////////////////////////////
  1974. template <typename RT, typename ClassT,
  1975. typename A, typename B, typename C, typename D,
  1976. typename E, typename F, typename G, typename H, typename I,
  1977. typename J, typename K, typename L
  1978. >
  1979. struct member_function_ptr_action<RT, ClassT,
  1980. A, B, C, D, E, F, G, H, I, J, K, L, nil_t, nil_t, nil_t, nil_t> {
  1981. typedef RT result_type;
  1982. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L);
  1983. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L) const;
  1984. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  1985. mem_func_ptr_t;
  1986. template <typename CT,
  1987. typename A_, typename B_, typename C_, typename D_,
  1988. typename E_, typename F_, typename G_, typename H_, typename I_,
  1989. typename J_, typename K_, typename L_
  1990. >
  1991. struct result { typedef result_type type; };
  1992. member_function_ptr_action(mem_func_ptr_t fptr_)
  1993. : fptr(fptr_) {}
  1994. template <typename CT>
  1995. result_type operator()(CT& obj,
  1996. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l
  1997. ) const
  1998. {
  1999. return (impl::as_ptr<CT>::get(obj)->*fptr)
  2000. (a, b, c, d, e, f, g, h, i, j, k, l);
  2001. }
  2002. mem_func_ptr_t fptr;
  2003. };
  2004. //////////////////////////////////
  2005. template <typename RT, typename ClassT,
  2006. typename A, typename B, typename C, typename D,
  2007. typename E, typename F, typename G, typename H, typename I,
  2008. typename J, typename K, typename L
  2009. >
  2010. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L>
  2011. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L))
  2012. {
  2013. return member_function_ptr<
  2014. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L>(fptr);
  2015. }
  2016. //////////////////////////////////
  2017. template <typename RT, typename ClassT,
  2018. typename A, typename B, typename C, typename D,
  2019. typename E, typename F, typename G, typename H, typename I,
  2020. typename J, typename K, typename L
  2021. >
  2022. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L>
  2023. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L) const)
  2024. {
  2025. return member_function_ptr<
  2026. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L>(fptr);
  2027. }
  2028. ///////////////////////////////////////////////////////////////////////////////
  2029. //
  2030. // Member function pointer binder (specialization for 13 args)
  2031. //
  2032. ///////////////////////////////////////////////////////////////////////////////
  2033. template <typename RT, typename ClassT,
  2034. typename A, typename B, typename C, typename D,
  2035. typename E, typename F, typename G, typename H, typename I,
  2036. typename J, typename K, typename L, typename M
  2037. >
  2038. struct member_function_ptr_action<RT, ClassT,
  2039. A, B, C, D, E, F, G, H, I, J, K, L, M, nil_t, nil_t, nil_t> {
  2040. typedef RT result_type;
  2041. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M);
  2042. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M) const;
  2043. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2044. mem_func_ptr_t;
  2045. template <typename CT,
  2046. typename A_, typename B_, typename C_, typename D_,
  2047. typename E_, typename F_, typename G_, typename H_, typename I_,
  2048. typename J_, typename K_, typename L_, typename M_
  2049. >
  2050. struct result { typedef result_type type; };
  2051. member_function_ptr_action(mem_func_ptr_t fptr_)
  2052. : fptr(fptr_) {}
  2053. template <typename CT>
  2054. result_type operator()(CT& obj,
  2055. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m
  2056. ) const
  2057. {
  2058. return (impl::as_ptr<CT>::get(obj)->*fptr)
  2059. (a, b, c, d, e, f, g, h, i, j, k, l, m);
  2060. }
  2061. mem_func_ptr_t fptr;
  2062. };
  2063. //////////////////////////////////
  2064. template <typename RT, typename ClassT,
  2065. typename A, typename B, typename C, typename D,
  2066. typename E, typename F, typename G, typename H, typename I,
  2067. typename J, typename K, typename L, typename M
  2068. >
  2069. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M>
  2070. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M))
  2071. {
  2072. return member_function_ptr<
  2073. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M>(fptr);
  2074. }
  2075. //////////////////////////////////
  2076. template <typename RT, typename ClassT,
  2077. typename A, typename B, typename C, typename D,
  2078. typename E, typename F, typename G, typename H, typename I,
  2079. typename J, typename K, typename L, typename M
  2080. >
  2081. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M>
  2082. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M) const)
  2083. {
  2084. return member_function_ptr<
  2085. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M>(fptr);
  2086. }
  2087. ///////////////////////////////////////////////////////////////////////////////
  2088. //
  2089. // Member function pointer binder (specialization for 14 args)
  2090. //
  2091. ///////////////////////////////////////////////////////////////////////////////
  2092. template <typename RT, typename ClassT,
  2093. typename A, typename B, typename C, typename D,
  2094. typename E, typename F, typename G, typename H, typename I,
  2095. typename J, typename K, typename L, typename M, typename N
  2096. >
  2097. struct member_function_ptr_action<RT, ClassT,
  2098. A, B, C, D, E, F, G, H, I, J, K, L, M, N, nil_t, nil_t> {
  2099. typedef RT result_type;
  2100. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N);
  2101. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const;
  2102. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2103. mem_func_ptr_t;
  2104. template <typename CT,
  2105. typename A_, typename B_, typename C_, typename D_,
  2106. typename E_, typename F_, typename G_, typename H_, typename I_,
  2107. typename J_, typename K_, typename L_, typename M_, typename N_
  2108. >
  2109. struct result { typedef result_type type; };
  2110. member_function_ptr_action(mem_func_ptr_t fptr_)
  2111. : fptr(fptr_) {}
  2112. template <typename CT>
  2113. result_type operator()(CT& obj,
  2114. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n
  2115. ) const
  2116. {
  2117. return (impl::as_ptr<CT>::get(obj)->*fptr)
  2118. (a, b, c, d, e, f, g, h, i, j, k, l, m, n);
  2119. }
  2120. mem_func_ptr_t fptr;
  2121. };
  2122. //////////////////////////////////
  2123. template <typename RT, typename ClassT,
  2124. typename A, typename B, typename C, typename D,
  2125. typename E, typename F, typename G, typename H, typename I,
  2126. typename J, typename K, typename L, typename M, typename N
  2127. >
  2128. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>
  2129. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N))
  2130. {
  2131. return member_function_ptr<
  2132. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(fptr);
  2133. }
  2134. //////////////////////////////////
  2135. template <typename RT, typename ClassT,
  2136. typename A, typename B, typename C, typename D,
  2137. typename E, typename F, typename G, typename H, typename I,
  2138. typename J, typename K, typename L, typename M, typename N
  2139. >
  2140. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N>
  2141. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const)
  2142. {
  2143. return member_function_ptr<
  2144. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(fptr);
  2145. }
  2146. ///////////////////////////////////////////////////////////////////////////////
  2147. //
  2148. // Member function pointer binder (specialization for 15 args)
  2149. //
  2150. ///////////////////////////////////////////////////////////////////////////////
  2151. template <typename RT, typename ClassT,
  2152. typename A, typename B, typename C, typename D,
  2153. typename E, typename F, typename G, typename H, typename I,
  2154. typename J, typename K, typename L, typename M, typename N,
  2155. typename O
  2156. >
  2157. struct member_function_ptr_action<RT, ClassT,
  2158. A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, nil_t> {
  2159. typedef RT result_type;
  2160. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O);
  2161. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const;
  2162. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2163. mem_func_ptr_t;
  2164. template <typename CT,
  2165. typename A_, typename B_, typename C_, typename D_,
  2166. typename E_, typename F_, typename G_, typename H_, typename I_,
  2167. typename J_, typename K_, typename L_, typename M_, typename N_,
  2168. typename O_
  2169. >
  2170. struct result { typedef result_type type; };
  2171. member_function_ptr_action(mem_func_ptr_t fptr_)
  2172. : fptr(fptr_) {}
  2173. template <typename CT>
  2174. result_type operator()(CT& obj,
  2175. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o
  2176. ) const
  2177. {
  2178. return (impl::as_ptr<CT>::get(obj)->*fptr)
  2179. (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
  2180. }
  2181. mem_func_ptr_t fptr;
  2182. };
  2183. //////////////////////////////////
  2184. template <typename RT, typename ClassT,
  2185. typename A, typename B, typename C, typename D,
  2186. typename E, typename F, typename G, typename H, typename I,
  2187. typename J, typename K, typename L, typename M, typename N,
  2188. typename O
  2189. >
  2190. inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>
  2191. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O))
  2192. {
  2193. return member_function_ptr<
  2194. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(fptr);
  2195. }
  2196. //////////////////////////////////
  2197. template <typename RT, typename ClassT,
  2198. typename A, typename B, typename C, typename D,
  2199. typename E, typename F, typename G, typename H, typename I,
  2200. typename J, typename K, typename L, typename M, typename N,
  2201. typename O
  2202. >
  2203. inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>
  2204. bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const)
  2205. {
  2206. return member_function_ptr<
  2207. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(fptr);
  2208. }
  2209. #endif
  2210. #endif
  2211. #endif
  2212. #endif
  2213. ///////////////////////////////////////////////////////////////////////////////
  2214. //
  2215. // Bound member function binder (main class)
  2216. //
  2217. ///////////////////////////////////////////////////////////////////////////////
  2218. template <
  2219. typename RT,
  2220. typename ClassT
  2221. , typename A = nil_t
  2222. , typename B = nil_t
  2223. , typename C = nil_t
  2224. #if PHOENIX_LIMIT > 3
  2225. , typename D = nil_t
  2226. , typename E = nil_t
  2227. , typename F = nil_t
  2228. #if PHOENIX_LIMIT > 6
  2229. , typename G = nil_t
  2230. , typename H = nil_t
  2231. , typename I = nil_t
  2232. #if PHOENIX_LIMIT > 9
  2233. , typename J = nil_t
  2234. , typename K = nil_t
  2235. , typename L = nil_t
  2236. #if PHOENIX_LIMIT > 12
  2237. , typename M = nil_t
  2238. , typename N = nil_t
  2239. , typename O = nil_t
  2240. #endif
  2241. #endif
  2242. #endif
  2243. #endif
  2244. , typename NU = nil_t // Not used
  2245. >
  2246. struct bound_member_action;
  2247. //////////////////////////////////
  2248. template <
  2249. typename RT,
  2250. typename ClassT
  2251. , typename A = nil_t
  2252. , typename B = nil_t
  2253. , typename C = nil_t
  2254. #if PHOENIX_LIMIT > 3
  2255. , typename D = nil_t
  2256. , typename E = nil_t
  2257. , typename F = nil_t
  2258. #if PHOENIX_LIMIT > 6
  2259. , typename G = nil_t
  2260. , typename H = nil_t
  2261. , typename I = nil_t
  2262. #if PHOENIX_LIMIT > 9
  2263. , typename J = nil_t
  2264. , typename K = nil_t
  2265. , typename L = nil_t
  2266. #if PHOENIX_LIMIT > 12
  2267. , typename M = nil_t
  2268. , typename N = nil_t
  2269. , typename O = nil_t
  2270. #endif
  2271. #endif
  2272. #endif
  2273. #endif
  2274. >
  2275. struct bound_member
  2276. : public function<bound_member_action<RT, ClassT
  2277. , A, B, C
  2278. #if PHOENIX_LIMIT > 3
  2279. , D, E, F
  2280. #if PHOENIX_LIMIT > 6
  2281. , G, H, I
  2282. #if PHOENIX_LIMIT > 9
  2283. , J, K, L
  2284. #if PHOENIX_LIMIT > 12
  2285. , M, N, O
  2286. #endif
  2287. #endif
  2288. #endif
  2289. #endif
  2290. > > {
  2291. typedef bound_member_action<RT, ClassT
  2292. , A, B, C
  2293. #if PHOENIX_LIMIT > 3
  2294. , D, E, F
  2295. #if PHOENIX_LIMIT > 6
  2296. , G, H, I
  2297. #if PHOENIX_LIMIT > 9
  2298. , J, K, L
  2299. #if PHOENIX_LIMIT > 12
  2300. , M, N, O
  2301. #endif
  2302. #endif
  2303. #endif
  2304. #endif
  2305. > action_t;
  2306. template <typename CT, typename FPT>
  2307. bound_member(CT & c, FPT fp)
  2308. : function<action_t>(action_t(c,fp)) {}
  2309. #if !defined(__BORLANDC__)
  2310. template <typename CT, typename FPT>
  2311. bound_member(CT * c, FPT fp)
  2312. : function<action_t>(action_t(c,fp)) {}
  2313. #endif
  2314. };
  2315. ///////////////////////////////////////////////////////////////////////////////
  2316. //
  2317. // Bound member function binder (specialization for 0 arg)
  2318. //
  2319. ///////////////////////////////////////////////////////////////////////////////
  2320. template <typename RT, typename ClassT>
  2321. struct bound_member_action<RT, ClassT,
  2322. nil_t, nil_t, nil_t,
  2323. #if PHOENIX_LIMIT > 3
  2324. nil_t, nil_t, nil_t,
  2325. #if PHOENIX_LIMIT > 6
  2326. nil_t, nil_t, nil_t,
  2327. #if PHOENIX_LIMIT > 9
  2328. nil_t, nil_t, nil_t,
  2329. #if PHOENIX_LIMIT > 12
  2330. nil_t, nil_t, nil_t,
  2331. #endif
  2332. #endif
  2333. #endif
  2334. #endif
  2335. nil_t // Unused
  2336. > {
  2337. typedef RT result_type;
  2338. typedef RT(ClassT::*mf)();
  2339. typedef RT(ClassT::*cmf)() const;
  2340. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2341. mem_func_ptr_t;
  2342. template <typename CT>
  2343. struct result { typedef result_type type; };
  2344. template <typename CT>
  2345. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2346. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2347. result_type operator()() const
  2348. { return (obj->*fptr)(); }
  2349. typename impl::as_ptr<ClassT>::pointer_type obj;
  2350. mem_func_ptr_t fptr;
  2351. };
  2352. //////////////////////////////////
  2353. template <typename RT, typename ClassT>
  2354. inline bound_member<RT,ClassT>
  2355. bind(ClassT & obj, RT(ClassT::*fptr)())
  2356. {
  2357. return bound_member<RT,ClassT>(obj, fptr);
  2358. }
  2359. template <typename RT, typename ClassT>
  2360. inline bound_member<RT,ClassT>
  2361. bind(ClassT * obj, RT(ClassT::*fptr)())
  2362. {
  2363. #if defined(__MWERKS__) && (__MWERKS__ < 0x3003)
  2364. return bound_member<RT,ClassT>(*obj, fptr);
  2365. #else
  2366. return bound_member<RT,ClassT>(obj, fptr);
  2367. #endif
  2368. }
  2369. template <typename RT, typename ClassT>
  2370. inline bound_member<RT,ClassT const>
  2371. bind(ClassT const& obj, RT(ClassT::*fptr)())
  2372. {
  2373. return bound_member<RT,ClassT const>(obj, fptr);
  2374. }
  2375. template <typename RT, typename ClassT>
  2376. inline bound_member<RT,ClassT const>
  2377. bind(ClassT const* obj, RT(ClassT::*fptr)() const)
  2378. {
  2379. #if defined(__MWERKS__) && (__MWERKS__ < 0x3003)
  2380. return bound_member<RT,ClassT const>(*obj, fptr);
  2381. #else
  2382. return bound_member<RT,ClassT const>(obj, fptr);
  2383. #endif
  2384. }
  2385. ///////////////////////////////////////////////////////////////////////////////
  2386. //
  2387. // Bound member function binder (specialization for 1 arg)
  2388. //
  2389. ///////////////////////////////////////////////////////////////////////////////
  2390. template <typename RT, typename ClassT, typename A>
  2391. struct bound_member_action<RT, ClassT,
  2392. A, nil_t, nil_t,
  2393. #if PHOENIX_LIMIT > 3
  2394. nil_t, nil_t, nil_t,
  2395. #if PHOENIX_LIMIT > 6
  2396. nil_t, nil_t, nil_t,
  2397. #if PHOENIX_LIMIT > 9
  2398. nil_t, nil_t, nil_t,
  2399. #if PHOENIX_LIMIT > 12
  2400. nil_t, nil_t, nil_t,
  2401. #endif
  2402. #endif
  2403. #endif
  2404. #endif
  2405. nil_t // Unused
  2406. > {
  2407. typedef RT result_type;
  2408. typedef RT(ClassT::*mf)(A);
  2409. typedef RT(ClassT::*cmf)(A) const;
  2410. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2411. mem_func_ptr_t;
  2412. template <typename A_>
  2413. struct result { typedef result_type type; };
  2414. template <typename CT>
  2415. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2416. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2417. result_type operator()(A a) const
  2418. { return (obj->*fptr)(a); }
  2419. typename impl::as_ptr<ClassT>::pointer_type obj;
  2420. mem_func_ptr_t fptr;
  2421. };
  2422. //////////////////////////////////
  2423. template <typename RT, typename ClassT, typename A>
  2424. inline bound_member<RT, ClassT, A>
  2425. bind(ClassT & obj, RT(ClassT::*fptr)(A))
  2426. {
  2427. return bound_member<RT, ClassT, A>(obj,fptr);
  2428. }
  2429. template <typename RT, typename ClassT, typename A>
  2430. inline bound_member<RT, ClassT, A>
  2431. bind(ClassT * obj, RT(ClassT::*fptr)(A))
  2432. {
  2433. return bound_member<RT, ClassT, A>(obj,fptr);
  2434. }
  2435. //////////////////////////////////
  2436. template <typename RT, typename ClassT, typename A>
  2437. inline bound_member<RT, ClassT const, A>
  2438. bind(ClassT const& obj, RT(ClassT::*fptr)(A) const)
  2439. {
  2440. return bound_member<RT, ClassT const, A>(obj,fptr);
  2441. }
  2442. template <typename RT, typename ClassT, typename A>
  2443. inline bound_member<RT, ClassT const, A>
  2444. bind(ClassT const* obj, RT(ClassT::*fptr)(A) const)
  2445. {
  2446. return bound_member<RT, ClassT const, A>(obj,fptr);
  2447. }
  2448. ///////////////////////////////////////////////////////////////////////////////
  2449. //
  2450. // Bound member function binder (specialization for 2 args)
  2451. //
  2452. ///////////////////////////////////////////////////////////////////////////////
  2453. template <typename RT, typename ClassT, typename A, typename B>
  2454. struct bound_member_action<RT, ClassT,
  2455. A, B, nil_t,
  2456. #if PHOENIX_LIMIT > 3
  2457. nil_t, nil_t, nil_t,
  2458. #if PHOENIX_LIMIT > 6
  2459. nil_t, nil_t, nil_t,
  2460. #if PHOENIX_LIMIT > 9
  2461. nil_t, nil_t, nil_t,
  2462. #if PHOENIX_LIMIT > 12
  2463. nil_t, nil_t, nil_t,
  2464. #endif
  2465. #endif
  2466. #endif
  2467. #endif
  2468. nil_t // Unused
  2469. > {
  2470. typedef RT result_type;
  2471. typedef RT(ClassT::*mf)(A, B);
  2472. typedef RT(ClassT::*cmf)(A, B) const;
  2473. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2474. mem_func_ptr_t;
  2475. template <typename A_, typename B_>
  2476. struct result { typedef result_type type; };
  2477. template <typename CT>
  2478. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2479. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2480. result_type operator()(A a, B b) const
  2481. { return (obj->*fptr)(a, b); }
  2482. typename impl::as_ptr<ClassT>::pointer_type obj;
  2483. mem_func_ptr_t fptr;
  2484. };
  2485. //////////////////////////////////
  2486. template <typename RT, typename ClassT, typename A, typename B>
  2487. inline bound_member<RT, ClassT, A, B>
  2488. bind(ClassT & obj,RT(ClassT::*fptr)(A, B))
  2489. {
  2490. return bound_member<RT, ClassT, A, B>(obj,fptr);
  2491. }
  2492. template <typename RT, typename ClassT, typename A, typename B>
  2493. inline bound_member<RT, ClassT, A, B>
  2494. bind(ClassT * obj,RT(ClassT::*fptr)(A, B))
  2495. {
  2496. return bound_member<RT, ClassT, A, B>(obj,fptr);
  2497. }
  2498. template <typename RT, typename ClassT, typename A, typename B>
  2499. inline bound_member<RT, ClassT const, A, B>
  2500. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B) const)
  2501. {
  2502. return bound_member<RT, ClassT const, A, B>(obj,fptr);
  2503. }
  2504. template <typename RT, typename ClassT, typename A, typename B>
  2505. inline bound_member<RT, ClassT const, A, B>
  2506. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B) const)
  2507. {
  2508. return bound_member<RT, ClassT const, A, B>(obj,fptr);
  2509. }
  2510. #if PHOENIX_LIMIT > 3
  2511. ///////////////////////////////////////////////////////////////////////////////
  2512. //
  2513. // Bound member function binder (specialization for 3 args)
  2514. //
  2515. ///////////////////////////////////////////////////////////////////////////////
  2516. template <typename RT, typename ClassT, typename A, typename B, typename C>
  2517. struct bound_member_action<RT, ClassT,
  2518. A, B, C, nil_t, nil_t, nil_t,
  2519. #if PHOENIX_LIMIT > 6
  2520. nil_t, nil_t, nil_t,
  2521. #if PHOENIX_LIMIT > 9
  2522. nil_t, nil_t, nil_t,
  2523. #if PHOENIX_LIMIT > 12
  2524. nil_t, nil_t, nil_t,
  2525. #endif
  2526. #endif
  2527. #endif
  2528. nil_t // Unused
  2529. > {
  2530. typedef RT result_type;
  2531. typedef RT(ClassT::*mf)(A, B, C);
  2532. typedef RT(ClassT::*cmf)(A, B, C) const;
  2533. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2534. mem_func_ptr_t;
  2535. template <typename A_, typename B_, typename C_>
  2536. struct result { typedef result_type type; };
  2537. template <typename CT>
  2538. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2539. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2540. result_type operator()(A a, B b, C c) const
  2541. { return (obj->*fptr)(a, b, c); }
  2542. typename impl::as_ptr<ClassT>::pointer_type obj;
  2543. mem_func_ptr_t fptr;
  2544. };
  2545. //////////////////////////////////
  2546. template <typename RT, typename ClassT, typename A, typename B, typename C>
  2547. inline bound_member<RT, ClassT, A, B, C>
  2548. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C))
  2549. {
  2550. return bound_member<RT, ClassT, A, B, C>(obj,fptr);
  2551. }
  2552. template <typename RT, typename ClassT, typename A, typename B, typename C>
  2553. inline bound_member<RT, ClassT, A, B, C>
  2554. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C))
  2555. {
  2556. return bound_member<RT, ClassT, A, B, C>(obj,fptr);
  2557. }
  2558. template <typename RT, typename ClassT, typename A, typename B, typename C>
  2559. inline bound_member<RT, ClassT const, A, B, C>
  2560. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C) const)
  2561. {
  2562. return bound_member<RT, ClassT const, A, B, C>(obj,fptr);
  2563. }
  2564. template <typename RT, typename ClassT, typename A, typename B, typename C>
  2565. inline bound_member<RT, ClassT const, A, B, C>
  2566. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C) const)
  2567. {
  2568. return bound_member<RT, ClassT const, A, B, C>(obj,fptr);
  2569. }
  2570. ///////////////////////////////////////////////////////////////////////////////
  2571. //
  2572. // Bound member function binder (specialization for 4 args)
  2573. //
  2574. ///////////////////////////////////////////////////////////////////////////////
  2575. template <typename RT, typename ClassT,
  2576. typename A, typename B, typename C, typename D
  2577. >
  2578. struct bound_member_action<RT, ClassT,
  2579. A, B, C, D, nil_t, nil_t,
  2580. #if PHOENIX_LIMIT > 6
  2581. nil_t, nil_t, nil_t,
  2582. #if PHOENIX_LIMIT > 9
  2583. nil_t, nil_t, nil_t,
  2584. #if PHOENIX_LIMIT > 12
  2585. nil_t, nil_t, nil_t,
  2586. #endif
  2587. #endif
  2588. #endif
  2589. nil_t // Unused
  2590. > {
  2591. typedef RT result_type;
  2592. typedef RT(ClassT::*mf)(A, B, C, D);
  2593. typedef RT(ClassT::*cmf)(A, B, C, D) const;
  2594. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2595. mem_func_ptr_t;
  2596. template <typename A_, typename B_, typename C_, typename D_>
  2597. struct result { typedef result_type type; };
  2598. template <typename CT>
  2599. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2600. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2601. result_type operator()(A a, B b, C c, D d) const
  2602. { return (obj->*fptr)(a, b, c, d); }
  2603. typename impl::as_ptr<ClassT>::pointer_type obj;
  2604. mem_func_ptr_t fptr;
  2605. };
  2606. //////////////////////////////////
  2607. template <typename RT, typename ClassT,
  2608. typename A, typename B, typename C, typename D
  2609. >
  2610. inline bound_member<RT, ClassT, A, B, C, D>
  2611. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D))
  2612. {
  2613. return bound_member<
  2614. RT, ClassT, A, B, C, D>(obj,fptr);
  2615. }
  2616. template <typename RT, typename ClassT,
  2617. typename A, typename B, typename C, typename D
  2618. >
  2619. inline bound_member<RT, ClassT, A, B, C, D>
  2620. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D))
  2621. {
  2622. return bound_member<
  2623. RT, ClassT, A, B, C, D>(obj,fptr);
  2624. }
  2625. template <typename RT, typename ClassT,
  2626. typename A, typename B, typename C, typename D
  2627. >
  2628. inline bound_member<RT, ClassT const, A, B, C, D>
  2629. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D) const)
  2630. {
  2631. return bound_member<
  2632. RT, ClassT const, A, B, C, D>(obj,fptr);
  2633. }
  2634. template <typename RT, typename ClassT,
  2635. typename A, typename B, typename C, typename D
  2636. >
  2637. inline bound_member<RT, ClassT const, A, B, C, D>
  2638. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D) const)
  2639. {
  2640. return bound_member<
  2641. RT, ClassT const, A, B, C, D>(obj,fptr);
  2642. }
  2643. ///////////////////////////////////////////////////////////////////////////////
  2644. //
  2645. // Bound member function binder (specialization for 5 args)
  2646. //
  2647. ///////////////////////////////////////////////////////////////////////////////
  2648. template <typename RT, typename ClassT,
  2649. typename A, typename B, typename C, typename D,
  2650. typename E
  2651. >
  2652. struct bound_member_action<RT, ClassT,
  2653. A, B, C, D, E, nil_t,
  2654. #if PHOENIX_LIMIT > 6
  2655. nil_t, nil_t, nil_t,
  2656. #if PHOENIX_LIMIT > 9
  2657. nil_t, nil_t, nil_t,
  2658. #if PHOENIX_LIMIT > 12
  2659. nil_t, nil_t, nil_t,
  2660. #endif
  2661. #endif
  2662. #endif
  2663. nil_t // Unused
  2664. > {
  2665. typedef RT result_type;
  2666. typedef RT(ClassT::*mf)(A, B, C, D, E);
  2667. typedef RT(ClassT::*cmf)(A, B, C, D, E) const;
  2668. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2669. mem_func_ptr_t;
  2670. template <typename A_, typename B_, typename C_, typename D_,
  2671. typename E_
  2672. >
  2673. struct result { typedef result_type type; };
  2674. template <typename CT>
  2675. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2676. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2677. result_type operator()(
  2678. A a, B b, C c, D d, E e
  2679. ) const
  2680. { return (obj->*fptr)(a, b, c, d, e); }
  2681. typename impl::as_ptr<ClassT>::pointer_type obj;
  2682. mem_func_ptr_t fptr;
  2683. };
  2684. //////////////////////////////////
  2685. template <typename RT, typename ClassT,
  2686. typename A, typename B, typename C, typename D,
  2687. typename E
  2688. >
  2689. inline bound_member<RT, ClassT, A, B, C, D, E>
  2690. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E))
  2691. {
  2692. return bound_member<
  2693. RT, ClassT, A, B, C, D, E>(obj,fptr);
  2694. }
  2695. template <typename RT, typename ClassT,
  2696. typename A, typename B, typename C, typename D,
  2697. typename E
  2698. >
  2699. inline bound_member<RT, ClassT, A, B, C, D, E>
  2700. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E))
  2701. {
  2702. return bound_member<
  2703. RT, ClassT, A, B, C, D, E>(obj,fptr);
  2704. }
  2705. template <typename RT, typename ClassT,
  2706. typename A, typename B, typename C, typename D,
  2707. typename E
  2708. >
  2709. inline bound_member<RT, ClassT const, A, B, C, D, E>
  2710. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E) const)
  2711. {
  2712. return bound_member<
  2713. RT, ClassT const, A, B, C, D, E>(obj,fptr);
  2714. }
  2715. template <typename RT, typename ClassT,
  2716. typename A, typename B, typename C, typename D,
  2717. typename E
  2718. >
  2719. inline bound_member<RT, ClassT const, A, B, C, D, E>
  2720. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E) const)
  2721. {
  2722. return bound_member<
  2723. RT, ClassT const, A, B, C, D, E>(obj,fptr);
  2724. }
  2725. #if PHOENIX_LIMIT > 6
  2726. ///////////////////////////////////////////////////////////////////////////////
  2727. //
  2728. // Bound member function binder (specialization for 6 args)
  2729. //
  2730. ///////////////////////////////////////////////////////////////////////////////
  2731. template <typename RT, typename ClassT,
  2732. typename A, typename B, typename C, typename D,
  2733. typename E, typename F
  2734. >
  2735. struct bound_member_action<RT, ClassT,
  2736. A, B, C, D, E, F, nil_t, nil_t, nil_t,
  2737. #if PHOENIX_LIMIT > 9
  2738. nil_t, nil_t, nil_t,
  2739. #if PHOENIX_LIMIT > 12
  2740. nil_t, nil_t, nil_t,
  2741. #endif
  2742. #endif
  2743. nil_t // Unused
  2744. > {
  2745. typedef RT result_type;
  2746. typedef RT(ClassT::*mf)(A, B, C, D, E, F);
  2747. typedef RT(ClassT::*cmf)(A, B, C, D, E, F) const;
  2748. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2749. mem_func_ptr_t;
  2750. template <
  2751. typename A_, typename B_, typename C_, typename D_,
  2752. typename E_, typename F_
  2753. >
  2754. struct result { typedef result_type type; };
  2755. template <typename CT>
  2756. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2757. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2758. result_type operator()(
  2759. A a, B b, C c, D d, E e, F f
  2760. ) const
  2761. { return (obj->*fptr)(a, b, c, d, e, f); }
  2762. typename impl::as_ptr<ClassT>::pointer_type obj;
  2763. mem_func_ptr_t fptr;
  2764. };
  2765. //////////////////////////////////
  2766. template <typename RT, typename ClassT,
  2767. typename A, typename B, typename C, typename D,
  2768. typename E, typename F
  2769. >
  2770. inline bound_member<RT, ClassT, A, B, C, D, E, F>
  2771. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F))
  2772. {
  2773. return bound_member<
  2774. RT, ClassT, A, B, C, D, E, F>(obj,fptr);
  2775. }
  2776. template <typename RT, typename ClassT,
  2777. typename A, typename B, typename C, typename D,
  2778. typename E, typename F
  2779. >
  2780. inline bound_member<RT, ClassT, A, B, C, D, E, F>
  2781. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F))
  2782. {
  2783. return bound_member<
  2784. RT, ClassT, A, B, C, D, E, F>(obj,fptr);
  2785. }
  2786. template <typename RT, typename ClassT,
  2787. typename A, typename B, typename C, typename D,
  2788. typename E, typename F
  2789. >
  2790. inline bound_member<RT, ClassT const, A, B, C, D, E, F>
  2791. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F) const)
  2792. {
  2793. return bound_member<
  2794. RT, ClassT const, A, B, C, D, E, F>(obj,fptr);
  2795. }
  2796. template <typename RT, typename ClassT,
  2797. typename A, typename B, typename C, typename D,
  2798. typename E, typename F
  2799. >
  2800. inline bound_member<RT, ClassT const, A, B, C, D, E, F>
  2801. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F) const)
  2802. {
  2803. return bound_member<
  2804. RT, ClassT const, A, B, C, D, E, F>(obj,fptr);
  2805. }
  2806. ///////////////////////////////////////////////////////////////////////////////
  2807. //
  2808. // Bound member function binder (specialization for 7 args)
  2809. //
  2810. ///////////////////////////////////////////////////////////////////////////////
  2811. template <typename RT, typename ClassT,
  2812. typename A, typename B, typename C, typename D,
  2813. typename E, typename F, typename G
  2814. >
  2815. struct bound_member_action<RT, ClassT,
  2816. A, B, C, D, E, F, G, nil_t, nil_t,
  2817. #if PHOENIX_LIMIT > 9
  2818. nil_t, nil_t, nil_t,
  2819. #if PHOENIX_LIMIT > 12
  2820. nil_t, nil_t, nil_t,
  2821. #endif
  2822. #endif
  2823. nil_t // Unused
  2824. > {
  2825. typedef RT result_type;
  2826. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G);
  2827. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G) const;
  2828. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2829. mem_func_ptr_t;
  2830. template <
  2831. typename A_, typename B_, typename C_, typename D_,
  2832. typename E_, typename F_, typename G_
  2833. >
  2834. struct result { typedef result_type type; };
  2835. template <typename CT>
  2836. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2837. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2838. result_type operator()(
  2839. A a, B b, C c, D d, E e, F f, G g
  2840. ) const
  2841. { return (obj->*fptr)(a, b, c, d, e, f, g); }
  2842. typename impl::as_ptr<ClassT>::pointer_type obj;
  2843. mem_func_ptr_t fptr;
  2844. };
  2845. //////////////////////////////////
  2846. template <typename RT, typename ClassT,
  2847. typename A, typename B, typename C, typename D,
  2848. typename E, typename F, typename G
  2849. >
  2850. inline bound_member<RT, ClassT, A, B, C, D, E, F, G>
  2851. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G))
  2852. {
  2853. return bound_member<
  2854. RT, ClassT, A, B, C, D, E, F, G>(obj,fptr);
  2855. }
  2856. template <typename RT, typename ClassT,
  2857. typename A, typename B, typename C, typename D,
  2858. typename E, typename F, typename G
  2859. >
  2860. inline bound_member<RT, ClassT, A, B, C, D, E, F, G>
  2861. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G))
  2862. {
  2863. return bound_member<
  2864. RT, ClassT, A, B, C, D, E, F, G>(obj,fptr);
  2865. }
  2866. template <typename RT, typename ClassT,
  2867. typename A, typename B, typename C, typename D,
  2868. typename E, typename F, typename G
  2869. >
  2870. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G>
  2871. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G) const)
  2872. {
  2873. return bound_member<
  2874. RT, ClassT const, A, B, C, D, E, F, G>(obj,fptr);
  2875. }
  2876. template <typename RT, typename ClassT,
  2877. typename A, typename B, typename C, typename D,
  2878. typename E, typename F, typename G
  2879. >
  2880. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G>
  2881. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G) const)
  2882. {
  2883. return bound_member<
  2884. RT, ClassT const, A, B, C, D, E, F, G>(obj,fptr);
  2885. }
  2886. ///////////////////////////////////////////////////////////////////////////////
  2887. //
  2888. // Bound member function binder (specialization for 8 args)
  2889. //
  2890. ///////////////////////////////////////////////////////////////////////////////
  2891. template <typename RT, typename ClassT,
  2892. typename A, typename B, typename C, typename D,
  2893. typename E, typename F, typename G, typename H
  2894. >
  2895. struct bound_member_action<RT, ClassT,
  2896. A, B, C, D, E, F, G, H, nil_t,
  2897. #if PHOENIX_LIMIT > 9
  2898. nil_t, nil_t, nil_t,
  2899. #if PHOENIX_LIMIT > 12
  2900. nil_t, nil_t, nil_t,
  2901. #endif
  2902. #endif
  2903. nil_t // Unused
  2904. > {
  2905. typedef RT result_type;
  2906. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H);
  2907. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H) const;
  2908. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2909. mem_func_ptr_t;
  2910. template <
  2911. typename A_, typename B_, typename C_, typename D_,
  2912. typename E_, typename F_, typename G_, typename H_
  2913. >
  2914. struct result { typedef result_type type; };
  2915. template <typename CT>
  2916. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2917. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2918. result_type operator()(
  2919. A a, B b, C c, D d, E e, F f, G g, H h
  2920. ) const
  2921. { return (obj->*fptr)(a, b, c, d, e, f, g, h); }
  2922. typename impl::as_ptr<ClassT>::pointer_type obj;
  2923. mem_func_ptr_t fptr;
  2924. };
  2925. //////////////////////////////////
  2926. template <typename RT, typename ClassT,
  2927. typename A, typename B, typename C, typename D,
  2928. typename E, typename F, typename G, typename H
  2929. >
  2930. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H>
  2931. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H))
  2932. {
  2933. return bound_member<
  2934. RT, ClassT, A, B, C, D, E, F, G, H>(obj,fptr);
  2935. }
  2936. template <typename RT, typename ClassT,
  2937. typename A, typename B, typename C, typename D,
  2938. typename E, typename F, typename G, typename H
  2939. >
  2940. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H>
  2941. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H))
  2942. {
  2943. return bound_member<
  2944. RT, ClassT, A, B, C, D, E, F, G, H>(obj,fptr);
  2945. }
  2946. template <typename RT, typename ClassT,
  2947. typename A, typename B, typename C, typename D,
  2948. typename E, typename F, typename G, typename H
  2949. >
  2950. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H>
  2951. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H) const)
  2952. {
  2953. return bound_member<
  2954. RT, ClassT const, A, B, C, D, E, F, G, H>(obj,fptr);
  2955. }
  2956. template <typename RT, typename ClassT,
  2957. typename A, typename B, typename C, typename D,
  2958. typename E, typename F, typename G, typename H
  2959. >
  2960. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H>
  2961. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H) const)
  2962. {
  2963. return bound_member<
  2964. RT, ClassT const, A, B, C, D, E, F, G, H>(obj,fptr);
  2965. }
  2966. #if PHOENIX_LIMIT > 9
  2967. ///////////////////////////////////////////////////////////////////////////////
  2968. //
  2969. // Bound member function binder (specialization for 9 args)
  2970. //
  2971. ///////////////////////////////////////////////////////////////////////////////
  2972. template <typename RT, typename ClassT,
  2973. typename A, typename B, typename C, typename D,
  2974. typename E, typename F, typename G, typename H, typename I
  2975. >
  2976. struct bound_member_action<RT, ClassT,
  2977. A, B, C, D, E, F, G, H, I, nil_t, nil_t, nil_t,
  2978. #if PHOENIX_LIMIT > 12
  2979. nil_t, nil_t, nil_t,
  2980. #endif
  2981. nil_t // Unused
  2982. > {
  2983. typedef RT result_type;
  2984. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I);
  2985. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I) const;
  2986. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  2987. mem_func_ptr_t;
  2988. template <
  2989. typename A_, typename B_, typename C_, typename D_,
  2990. typename E_, typename F_, typename G_, typename H_, typename I_
  2991. >
  2992. struct result { typedef result_type type; };
  2993. template <typename CT>
  2994. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  2995. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  2996. result_type operator()(
  2997. A a, B b, C c, D d, E e, F f, G g, H h, I i
  2998. ) const
  2999. { return (obj->*fptr)(a, b, c, d, e, f, g, h, i); }
  3000. typename impl::as_ptr<ClassT>::pointer_type obj;
  3001. mem_func_ptr_t fptr;
  3002. };
  3003. //////////////////////////////////
  3004. template <typename RT, typename ClassT,
  3005. typename A, typename B, typename C, typename D,
  3006. typename E, typename F, typename G, typename H, typename I
  3007. >
  3008. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I>
  3009. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I))
  3010. {
  3011. return bound_member<
  3012. RT, ClassT, A, B, C, D, E, F, G, H, I>(obj,fptr);
  3013. }
  3014. template <typename RT, typename ClassT,
  3015. typename A, typename B, typename C, typename D,
  3016. typename E, typename F, typename G, typename H, typename I
  3017. >
  3018. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I>
  3019. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I))
  3020. {
  3021. return bound_member<
  3022. RT, ClassT, A, B, C, D, E, F, G, H, I>(obj,fptr);
  3023. }
  3024. template <typename RT, typename ClassT,
  3025. typename A, typename B, typename C, typename D,
  3026. typename E, typename F, typename G, typename H, typename I
  3027. >
  3028. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I>
  3029. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I) const)
  3030. {
  3031. return bound_member<
  3032. RT, ClassT const, A, B, C, D, E, F, G, H, I>(obj,fptr);
  3033. }
  3034. template <typename RT, typename ClassT,
  3035. typename A, typename B, typename C, typename D,
  3036. typename E, typename F, typename G, typename H, typename I
  3037. >
  3038. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I>
  3039. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I) const)
  3040. {
  3041. return bound_member<
  3042. RT, ClassT const, A, B, C, D, E, F, G, H, I>(obj,fptr);
  3043. }
  3044. ///////////////////////////////////////////////////////////////////////////////
  3045. //
  3046. // Bound member function binder (specialization for 10 args)
  3047. //
  3048. ///////////////////////////////////////////////////////////////////////////////
  3049. template <typename RT, typename ClassT,
  3050. typename A, typename B, typename C, typename D,
  3051. typename E, typename F, typename G, typename H, typename I,
  3052. typename J
  3053. >
  3054. struct bound_member_action<RT, ClassT,
  3055. A, B, C, D, E, F, G, H, I, J, nil_t, nil_t,
  3056. #if PHOENIX_LIMIT > 12
  3057. nil_t, nil_t, nil_t,
  3058. #endif
  3059. nil_t // Unused
  3060. > {
  3061. typedef RT result_type;
  3062. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J);
  3063. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J) const;
  3064. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  3065. mem_func_ptr_t;
  3066. template <
  3067. typename A_, typename B_, typename C_, typename D_,
  3068. typename E_, typename F_, typename G_, typename H_, typename I_,
  3069. typename J_
  3070. >
  3071. struct result { typedef result_type type; };
  3072. template <typename CT>
  3073. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  3074. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  3075. result_type operator()(
  3076. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j
  3077. ) const
  3078. {
  3079. return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j);
  3080. }
  3081. typename impl::as_ptr<ClassT>::pointer_type obj;
  3082. mem_func_ptr_t fptr;
  3083. };
  3084. //////////////////////////////////
  3085. template <typename RT, typename ClassT,
  3086. typename A, typename B, typename C, typename D,
  3087. typename E, typename F, typename G, typename H, typename I,
  3088. typename J
  3089. >
  3090. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J>
  3091. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J))
  3092. {
  3093. return bound_member<
  3094. RT, ClassT, A, B, C, D, E, F, G, H, I, J>(obj,fptr);
  3095. }
  3096. template <typename RT, typename ClassT,
  3097. typename A, typename B, typename C, typename D,
  3098. typename E, typename F, typename G, typename H, typename I,
  3099. typename J
  3100. >
  3101. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J>
  3102. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J))
  3103. {
  3104. return bound_member<
  3105. RT, ClassT, A, B, C, D, E, F, G, H, I, J>(obj,fptr);
  3106. }
  3107. template <typename RT, typename ClassT,
  3108. typename A, typename B, typename C, typename D,
  3109. typename E, typename F, typename G, typename H, typename I,
  3110. typename J
  3111. >
  3112. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J>
  3113. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J) const)
  3114. {
  3115. return bound_member<
  3116. RT, ClassT const, A, B, C, D, E, F, G, H, I, J>(obj,fptr);
  3117. }
  3118. template <typename RT, typename ClassT,
  3119. typename A, typename B, typename C, typename D,
  3120. typename E, typename F, typename G, typename H, typename I,
  3121. typename J
  3122. >
  3123. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J>
  3124. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J) const)
  3125. {
  3126. return bound_member<
  3127. RT, ClassT const, A, B, C, D, E, F, G, H, I, J>(obj,fptr);
  3128. }
  3129. ///////////////////////////////////////////////////////////////////////////////
  3130. //
  3131. // Bound member function binder (specialization for 11 args)
  3132. //
  3133. ///////////////////////////////////////////////////////////////////////////////
  3134. template <typename RT, typename ClassT,
  3135. typename A, typename B, typename C, typename D,
  3136. typename E, typename F, typename G, typename H, typename I,
  3137. typename J, typename K
  3138. >
  3139. struct bound_member_action<RT, ClassT,
  3140. A, B, C, D, E, F, G, H, I, J, K, nil_t,
  3141. #if PHOENIX_LIMIT > 12
  3142. nil_t, nil_t, nil_t,
  3143. #endif
  3144. nil_t // Unused
  3145. > {
  3146. typedef RT result_type;
  3147. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K);
  3148. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K) const;
  3149. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  3150. mem_func_ptr_t;
  3151. template <
  3152. typename A_, typename B_, typename C_, typename D_,
  3153. typename E_, typename F_, typename G_, typename H_, typename I_,
  3154. typename J_, typename K_
  3155. >
  3156. struct result { typedef result_type type; };
  3157. template <typename CT>
  3158. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  3159. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  3160. result_type operator()(
  3161. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k
  3162. ) const
  3163. {
  3164. return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k);
  3165. }
  3166. typename impl::as_ptr<ClassT>::pointer_type obj;
  3167. mem_func_ptr_t fptr;
  3168. };
  3169. //////////////////////////////////
  3170. template <typename RT, typename ClassT,
  3171. typename A, typename B, typename C, typename D,
  3172. typename E, typename F, typename G, typename H, typename I,
  3173. typename J, typename K
  3174. >
  3175. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K>
  3176. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K))
  3177. {
  3178. return bound_member<
  3179. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K>(obj,fptr);
  3180. }
  3181. template <typename RT, typename ClassT,
  3182. typename A, typename B, typename C, typename D,
  3183. typename E, typename F, typename G, typename H, typename I,
  3184. typename J, typename K
  3185. >
  3186. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K>
  3187. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K))
  3188. {
  3189. return bound_member<
  3190. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K>(obj,fptr);
  3191. }
  3192. template <typename RT, typename ClassT,
  3193. typename A, typename B, typename C, typename D,
  3194. typename E, typename F, typename G, typename H, typename I,
  3195. typename J, typename K
  3196. >
  3197. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K>
  3198. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K) const)
  3199. {
  3200. return bound_member<
  3201. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K>(obj,fptr);
  3202. }
  3203. template <typename RT, typename ClassT,
  3204. typename A, typename B, typename C, typename D,
  3205. typename E, typename F, typename G, typename H, typename I,
  3206. typename J, typename K
  3207. >
  3208. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K>
  3209. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K) const)
  3210. {
  3211. return bound_member<
  3212. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K>(obj,fptr);
  3213. }
  3214. #if PHOENIX_LIMIT > 12
  3215. ///////////////////////////////////////////////////////////////////////////////
  3216. //
  3217. // Bound member function binder (specialization for 12 args)
  3218. //
  3219. ///////////////////////////////////////////////////////////////////////////////
  3220. template <typename RT, typename ClassT,
  3221. typename A, typename B, typename C, typename D,
  3222. typename E, typename F, typename G, typename H, typename I,
  3223. typename J, typename K, typename L
  3224. >
  3225. struct bound_member_action<RT, ClassT,
  3226. A, B, C, D, E, F, G, H, I, J, K, L, nil_t, nil_t, nil_t, nil_t> {
  3227. typedef RT result_type;
  3228. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L);
  3229. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L) const;
  3230. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  3231. mem_func_ptr_t;
  3232. template <
  3233. typename A_, typename B_, typename C_, typename D_,
  3234. typename E_, typename F_, typename G_, typename H_, typename I_,
  3235. typename J_, typename K_, typename L_
  3236. >
  3237. struct result { typedef result_type type; };
  3238. template <typename CT>
  3239. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  3240. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  3241. result_type operator()(
  3242. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l
  3243. ) const
  3244. {
  3245. return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k, l);
  3246. }
  3247. typename impl::as_ptr<ClassT>::pointer_type obj;
  3248. mem_func_ptr_t fptr;
  3249. };
  3250. //////////////////////////////////
  3251. template <typename RT, typename ClassT,
  3252. typename A, typename B, typename C, typename D,
  3253. typename E, typename F, typename G, typename H, typename I,
  3254. typename J, typename K, typename L
  3255. >
  3256. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L>
  3257. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L))
  3258. {
  3259. return bound_member<
  3260. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L>(obj,fptr);
  3261. }
  3262. template <typename RT, typename ClassT,
  3263. typename A, typename B, typename C, typename D,
  3264. typename E, typename F, typename G, typename H, typename I,
  3265. typename J, typename K, typename L
  3266. >
  3267. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L>
  3268. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L))
  3269. {
  3270. return bound_member<
  3271. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L>(obj,fptr);
  3272. }
  3273. template <typename RT, typename ClassT,
  3274. typename A, typename B, typename C, typename D,
  3275. typename E, typename F, typename G, typename H, typename I,
  3276. typename J, typename K, typename L
  3277. >
  3278. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L>
  3279. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L) const)
  3280. {
  3281. return bound_member<
  3282. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L>(obj,fptr);
  3283. }
  3284. template <typename RT, typename ClassT,
  3285. typename A, typename B, typename C, typename D,
  3286. typename E, typename F, typename G, typename H, typename I,
  3287. typename J, typename K, typename L
  3288. >
  3289. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L>
  3290. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L) const)
  3291. {
  3292. return bound_member<
  3293. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L>(obj,fptr);
  3294. }
  3295. ///////////////////////////////////////////////////////////////////////////////
  3296. //
  3297. // Bound member function binder (specialization for 13 args)
  3298. //
  3299. ///////////////////////////////////////////////////////////////////////////////
  3300. template <typename RT, typename ClassT,
  3301. typename A, typename B, typename C, typename D,
  3302. typename E, typename F, typename G, typename H, typename I,
  3303. typename J, typename K, typename L, typename M
  3304. >
  3305. struct bound_member_action<RT, ClassT,
  3306. A, B, C, D, E, F, G, H, I, J, K, L, M, nil_t, nil_t, nil_t> {
  3307. typedef RT result_type;
  3308. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M);
  3309. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M) const;
  3310. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  3311. mem_func_ptr_t;
  3312. template <
  3313. typename A_, typename B_, typename C_, typename D_,
  3314. typename E_, typename F_, typename G_, typename H_, typename I_,
  3315. typename J_, typename K_, typename L_, typename M_
  3316. >
  3317. struct result { typedef result_type type; };
  3318. template <typename CT>
  3319. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  3320. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  3321. result_type operator()(
  3322. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m
  3323. ) const
  3324. {
  3325. return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k, l, m);
  3326. }
  3327. typename impl::as_ptr<ClassT>::pointer_type obj;
  3328. mem_func_ptr_t fptr;
  3329. };
  3330. //////////////////////////////////
  3331. template <typename RT, typename ClassT,
  3332. typename A, typename B, typename C, typename D,
  3333. typename E, typename F, typename G, typename H, typename I,
  3334. typename J, typename K, typename L, typename M
  3335. >
  3336. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M>
  3337. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M))
  3338. {
  3339. return bound_member<
  3340. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M>(obj,fptr);
  3341. }
  3342. template <typename RT, typename ClassT,
  3343. typename A, typename B, typename C, typename D,
  3344. typename E, typename F, typename G, typename H, typename I,
  3345. typename J, typename K, typename L, typename M
  3346. >
  3347. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M>
  3348. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M))
  3349. {
  3350. return bound_member<
  3351. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M>(obj,fptr);
  3352. }
  3353. template <typename RT, typename ClassT,
  3354. typename A, typename B, typename C, typename D,
  3355. typename E, typename F, typename G, typename H, typename I,
  3356. typename J, typename K, typename L, typename M
  3357. >
  3358. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M>
  3359. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M) const)
  3360. {
  3361. return bound_member<
  3362. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M>(obj,fptr);
  3363. }
  3364. template <typename RT, typename ClassT,
  3365. typename A, typename B, typename C, typename D,
  3366. typename E, typename F, typename G, typename H, typename I,
  3367. typename J, typename K, typename L, typename M
  3368. >
  3369. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M>
  3370. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M) const)
  3371. {
  3372. return bound_member<
  3373. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M>(obj,fptr);
  3374. }
  3375. ///////////////////////////////////////////////////////////////////////////////
  3376. //
  3377. // Bound member function binder (specialization for 14 args)
  3378. //
  3379. ///////////////////////////////////////////////////////////////////////////////
  3380. template <typename RT, typename ClassT,
  3381. typename A, typename B, typename C, typename D,
  3382. typename E, typename F, typename G, typename H, typename I,
  3383. typename J, typename K, typename L, typename M, typename N
  3384. >
  3385. struct bound_member_action<RT, ClassT,
  3386. A, B, C, D, E, F, G, H, I, J, K, L, M, N, nil_t, nil_t> {
  3387. typedef RT result_type;
  3388. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N);
  3389. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const;
  3390. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  3391. mem_func_ptr_t;
  3392. template <
  3393. typename A_, typename B_, typename C_, typename D_,
  3394. typename E_, typename F_, typename G_, typename H_, typename I_,
  3395. typename J_, typename K_, typename L_, typename M_, typename N_
  3396. >
  3397. struct result { typedef result_type type; };
  3398. template <typename CT>
  3399. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  3400. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  3401. result_type operator()(
  3402. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n
  3403. ) const
  3404. {
  3405. return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k, l, m, n);
  3406. }
  3407. typename impl::as_ptr<ClassT>::pointer_type obj;
  3408. mem_func_ptr_t fptr;
  3409. };
  3410. //////////////////////////////////
  3411. template <typename RT, typename ClassT,
  3412. typename A, typename B, typename C, typename D,
  3413. typename E, typename F, typename G, typename H, typename I,
  3414. typename J, typename K, typename L, typename M, typename N
  3415. >
  3416. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>
  3417. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N))
  3418. {
  3419. return bound_member<
  3420. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(obj,fptr);
  3421. }
  3422. template <typename RT, typename ClassT,
  3423. typename A, typename B, typename C, typename D,
  3424. typename E, typename F, typename G, typename H, typename I,
  3425. typename J, typename K, typename L, typename M, typename N
  3426. >
  3427. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>
  3428. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N))
  3429. {
  3430. return bound_member<
  3431. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(obj,fptr);
  3432. }
  3433. template <typename RT, typename ClassT,
  3434. typename A, typename B, typename C, typename D,
  3435. typename E, typename F, typename G, typename H, typename I,
  3436. typename J, typename K, typename L, typename M, typename N
  3437. >
  3438. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N>
  3439. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const)
  3440. {
  3441. return bound_member<
  3442. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(obj,fptr);
  3443. }
  3444. template <typename RT, typename ClassT,
  3445. typename A, typename B, typename C, typename D,
  3446. typename E, typename F, typename G, typename H, typename I,
  3447. typename J, typename K, typename L, typename M, typename N
  3448. >
  3449. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N>
  3450. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const)
  3451. {
  3452. return bound_member<
  3453. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(obj,fptr);
  3454. }
  3455. ///////////////////////////////////////////////////////////////////////////////
  3456. //
  3457. // Bound member function binder (specialization for 15 args)
  3458. //
  3459. ///////////////////////////////////////////////////////////////////////////////
  3460. template <typename RT, typename ClassT,
  3461. typename A, typename B, typename C, typename D,
  3462. typename E, typename F, typename G, typename H, typename I,
  3463. typename J, typename K, typename L, typename M, typename N,
  3464. typename O
  3465. >
  3466. struct bound_member_action<RT, ClassT,
  3467. A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, nil_t> {
  3468. typedef RT result_type;
  3469. typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O);
  3470. typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const;
  3471. typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
  3472. mem_func_ptr_t;
  3473. template <
  3474. typename A_, typename B_, typename C_, typename D_,
  3475. typename E_, typename F_, typename G_, typename H_, typename I_,
  3476. typename J_, typename K_, typename L_, typename M_, typename N_,
  3477. typename O_
  3478. >
  3479. struct result { typedef result_type type; };
  3480. template <typename CT>
  3481. bound_member_action(CT & obj_, mem_func_ptr_t fptr_)
  3482. : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {}
  3483. result_type operator()(
  3484. A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o
  3485. ) const
  3486. {
  3487. return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
  3488. }
  3489. typename impl::as_ptr<ClassT>::pointer_type obj;
  3490. mem_func_ptr_t fptr;
  3491. };
  3492. //////////////////////////////////
  3493. template <typename RT, typename ClassT,
  3494. typename A, typename B, typename C, typename D,
  3495. typename E, typename F, typename G, typename H, typename I,
  3496. typename J, typename K, typename L, typename M, typename N,
  3497. typename O
  3498. >
  3499. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>
  3500. bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O))
  3501. {
  3502. return bound_member<
  3503. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(obj,fptr);
  3504. }
  3505. template <typename RT, typename ClassT,
  3506. typename A, typename B, typename C, typename D,
  3507. typename E, typename F, typename G, typename H, typename I,
  3508. typename J, typename K, typename L, typename M, typename N,
  3509. typename O
  3510. >
  3511. inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>
  3512. bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O))
  3513. {
  3514. return bound_member<
  3515. RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(obj,fptr);
  3516. }
  3517. template <typename RT, typename ClassT,
  3518. typename A, typename B, typename C, typename D,
  3519. typename E, typename F, typename G, typename H, typename I,
  3520. typename J, typename K, typename L, typename M, typename N,
  3521. typename O
  3522. >
  3523. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>
  3524. bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const)
  3525. {
  3526. return bound_member<
  3527. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(obj,fptr);
  3528. }
  3529. template <typename RT, typename ClassT,
  3530. typename A, typename B, typename C, typename D,
  3531. typename E, typename F, typename G, typename H, typename I,
  3532. typename J, typename K, typename L, typename M, typename N,
  3533. typename O
  3534. >
  3535. inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>
  3536. bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const)
  3537. {
  3538. return bound_member<
  3539. RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(obj,fptr);
  3540. }
  3541. #endif
  3542. #endif
  3543. #endif
  3544. #endif
  3545. } // namespace phoenix
  3546. #endif