mem_fn_template.hpp 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. //
  2. // bind/mem_fn_template.hpp
  3. //
  4. // Do not include this header directly
  5. //
  6. // Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
  7. //
  8. // Distributed under the Boost Software License, Version 1.0. (See
  9. // accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. //
  12. // See http://www.boost.org/libs/bind/mem_fn.html for documentation.
  13. //
  14. #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
  15. # define BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  16. #endif
  17. // mf0
  18. template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf0)
  19. {
  20. public:
  21. typedef R result_type;
  22. typedef T * argument_type;
  23. private:
  24. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) ())
  25. F f_;
  26. template<class U> R call(U & u, T const *) const
  27. {
  28. BOOST_MEM_FN_RETURN (u.*f_)();
  29. }
  30. template<class U> R call(U & u, void const *) const
  31. {
  32. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)();
  33. }
  34. public:
  35. explicit BOOST_MEM_FN_NAME(mf0)(F f): f_(f) {}
  36. R operator()(T * p) const
  37. {
  38. BOOST_MEM_FN_RETURN (p->*f_)();
  39. }
  40. template<class U> R operator()(U & u) const
  41. {
  42. U const * p = 0;
  43. BOOST_MEM_FN_RETURN call(u, p);
  44. }
  45. #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  46. template<class U> R operator()(U const & u) const
  47. {
  48. U const * p = 0;
  49. BOOST_MEM_FN_RETURN call(u, p);
  50. }
  51. #endif
  52. R operator()(T & t) const
  53. {
  54. BOOST_MEM_FN_RETURN (t.*f_)();
  55. }
  56. bool operator==(BOOST_MEM_FN_NAME(mf0) const & rhs) const
  57. {
  58. return f_ == rhs.f_;
  59. }
  60. bool operator!=(BOOST_MEM_FN_NAME(mf0) const & rhs) const
  61. {
  62. return f_ != rhs.f_;
  63. }
  64. };
  65. // cmf0
  66. template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf0)
  67. {
  68. public:
  69. typedef R result_type;
  70. typedef T const * argument_type;
  71. private:
  72. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) () const)
  73. F f_;
  74. template<class U> R call(U & u, T const *) const
  75. {
  76. BOOST_MEM_FN_RETURN (u.*f_)();
  77. }
  78. template<class U> R call(U & u, void const *) const
  79. {
  80. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)();
  81. }
  82. public:
  83. explicit BOOST_MEM_FN_NAME(cmf0)(F f): f_(f) {}
  84. template<class U> R operator()(U const & u) const
  85. {
  86. U const * p = 0;
  87. BOOST_MEM_FN_RETURN call(u, p);
  88. }
  89. R operator()(T const & t) const
  90. {
  91. BOOST_MEM_FN_RETURN (t.*f_)();
  92. }
  93. bool operator==(BOOST_MEM_FN_NAME(cmf0) const & rhs) const
  94. {
  95. return f_ == rhs.f_;
  96. }
  97. bool operator!=(BOOST_MEM_FN_NAME(cmf0) const & rhs) const
  98. {
  99. return f_ != rhs.f_;
  100. }
  101. };
  102. // mf1
  103. template<class R, class T, class A1 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf1)
  104. {
  105. public:
  106. typedef R result_type;
  107. typedef T * first_argument_type;
  108. typedef A1 second_argument_type;
  109. private:
  110. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1))
  111. F f_;
  112. template<class U, class B1> R call(U & u, T const *, B1 & b1) const
  113. {
  114. BOOST_MEM_FN_RETURN (u.*f_)(b1);
  115. }
  116. template<class U, class B1> R call(U & u, void const *, B1 & b1) const
  117. {
  118. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1);
  119. }
  120. public:
  121. explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {}
  122. R operator()(T * p, A1 a1) const
  123. {
  124. BOOST_MEM_FN_RETURN (p->*f_)(a1);
  125. }
  126. template<class U> R operator()(U & u, A1 a1) const
  127. {
  128. U const * p = 0;
  129. BOOST_MEM_FN_RETURN call(u, p, a1);
  130. }
  131. #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  132. template<class U> R operator()(U const & u, A1 a1) const
  133. {
  134. U const * p = 0;
  135. BOOST_MEM_FN_RETURN call(u, p, a1);
  136. }
  137. #endif
  138. R operator()(T & t, A1 a1) const
  139. {
  140. BOOST_MEM_FN_RETURN (t.*f_)(a1);
  141. }
  142. bool operator==(BOOST_MEM_FN_NAME(mf1) const & rhs) const
  143. {
  144. return f_ == rhs.f_;
  145. }
  146. bool operator!=(BOOST_MEM_FN_NAME(mf1) const & rhs) const
  147. {
  148. return f_ != rhs.f_;
  149. }
  150. };
  151. // cmf1
  152. template<class R, class T, class A1 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf1)
  153. {
  154. public:
  155. typedef R result_type;
  156. typedef T const * first_argument_type;
  157. typedef A1 second_argument_type;
  158. private:
  159. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1) const)
  160. F f_;
  161. template<class U, class B1> R call(U & u, T const *, B1 & b1) const
  162. {
  163. BOOST_MEM_FN_RETURN (u.*f_)(b1);
  164. }
  165. template<class U, class B1> R call(U & u, void const *, B1 & b1) const
  166. {
  167. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1);
  168. }
  169. public:
  170. explicit BOOST_MEM_FN_NAME(cmf1)(F f): f_(f) {}
  171. template<class U> R operator()(U const & u, A1 a1) const
  172. {
  173. U const * p = 0;
  174. BOOST_MEM_FN_RETURN call(u, p, a1);
  175. }
  176. R operator()(T const & t, A1 a1) const
  177. {
  178. BOOST_MEM_FN_RETURN (t.*f_)(a1);
  179. }
  180. bool operator==(BOOST_MEM_FN_NAME(cmf1) const & rhs) const
  181. {
  182. return f_ == rhs.f_;
  183. }
  184. bool operator!=(BOOST_MEM_FN_NAME(cmf1) const & rhs) const
  185. {
  186. return f_ != rhs.f_;
  187. }
  188. };
  189. // mf2
  190. template<class R, class T, class A1, class A2 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf2)
  191. {
  192. public:
  193. typedef R result_type;
  194. private:
  195. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2))
  196. F f_;
  197. template<class U, class B1, class B2> R call(U & u, T const *, B1 & b1, B2 & b2) const
  198. {
  199. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2);
  200. }
  201. template<class U, class B1, class B2> R call(U & u, void const *, B1 & b1, B2 & b2) const
  202. {
  203. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2);
  204. }
  205. public:
  206. explicit BOOST_MEM_FN_NAME(mf2)(F f): f_(f) {}
  207. R operator()(T * p, A1 a1, A2 a2) const
  208. {
  209. BOOST_MEM_FN_RETURN (p->*f_)(a1, a2);
  210. }
  211. template<class U> R operator()(U & u, A1 a1, A2 a2) const
  212. {
  213. U const * p = 0;
  214. BOOST_MEM_FN_RETURN call(u, p, a1, a2);
  215. }
  216. #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  217. template<class U> R operator()(U const & u, A1 a1, A2 a2) const
  218. {
  219. U const * p = 0;
  220. BOOST_MEM_FN_RETURN call(u, p, a1, a2);
  221. }
  222. #endif
  223. R operator()(T & t, A1 a1, A2 a2) const
  224. {
  225. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
  226. }
  227. bool operator==(BOOST_MEM_FN_NAME(mf2) const & rhs) const
  228. {
  229. return f_ == rhs.f_;
  230. }
  231. bool operator!=(BOOST_MEM_FN_NAME(mf2) const & rhs) const
  232. {
  233. return f_ != rhs.f_;
  234. }
  235. };
  236. // cmf2
  237. template<class R, class T, class A1, class A2 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf2)
  238. {
  239. public:
  240. typedef R result_type;
  241. private:
  242. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2) const)
  243. F f_;
  244. template<class U, class B1, class B2> R call(U & u, T const *, B1 & b1, B2 & b2) const
  245. {
  246. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2);
  247. }
  248. template<class U, class B1, class B2> R call(U & u, void const *, B1 & b1, B2 & b2) const
  249. {
  250. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2);
  251. }
  252. public:
  253. explicit BOOST_MEM_FN_NAME(cmf2)(F f): f_(f) {}
  254. template<class U> R operator()(U const & u, A1 a1, A2 a2) const
  255. {
  256. U const * p = 0;
  257. BOOST_MEM_FN_RETURN call(u, p, a1, a2);
  258. }
  259. R operator()(T const & t, A1 a1, A2 a2) const
  260. {
  261. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
  262. }
  263. bool operator==(BOOST_MEM_FN_NAME(cmf2) const & rhs) const
  264. {
  265. return f_ == rhs.f_;
  266. }
  267. bool operator!=(BOOST_MEM_FN_NAME(cmf2) const & rhs) const
  268. {
  269. return f_ != rhs.f_;
  270. }
  271. };
  272. // mf3
  273. template<class R, class T, class A1, class A2, class A3 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf3)
  274. {
  275. public:
  276. typedef R result_type;
  277. private:
  278. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3))
  279. F f_;
  280. template<class U, class B1, class B2, class B3> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const
  281. {
  282. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3);
  283. }
  284. template<class U, class B1, class B2, class B3> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const
  285. {
  286. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3);
  287. }
  288. public:
  289. explicit BOOST_MEM_FN_NAME(mf3)(F f): f_(f) {}
  290. R operator()(T * p, A1 a1, A2 a2, A3 a3) const
  291. {
  292. BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3);
  293. }
  294. template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3) const
  295. {
  296. U const * p = 0;
  297. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
  298. }
  299. #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  300. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
  301. {
  302. U const * p = 0;
  303. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
  304. }
  305. #endif
  306. R operator()(T & t, A1 a1, A2 a2, A3 a3) const
  307. {
  308. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
  309. }
  310. bool operator==(BOOST_MEM_FN_NAME(mf3) const & rhs) const
  311. {
  312. return f_ == rhs.f_;
  313. }
  314. bool operator!=(BOOST_MEM_FN_NAME(mf3) const & rhs) const
  315. {
  316. return f_ != rhs.f_;
  317. }
  318. };
  319. // cmf3
  320. template<class R, class T, class A1, class A2, class A3 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf3)
  321. {
  322. public:
  323. typedef R result_type;
  324. private:
  325. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const)
  326. F f_;
  327. template<class U, class B1, class B2, class B3> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const
  328. {
  329. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3);
  330. }
  331. template<class U, class B1, class B2, class B3> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const
  332. {
  333. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3);
  334. }
  335. public:
  336. explicit BOOST_MEM_FN_NAME(cmf3)(F f): f_(f) {}
  337. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
  338. {
  339. U const * p = 0;
  340. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
  341. }
  342. R operator()(T const & t, A1 a1, A2 a2, A3 a3) const
  343. {
  344. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
  345. }
  346. bool operator==(BOOST_MEM_FN_NAME(cmf3) const & rhs) const
  347. {
  348. return f_ == rhs.f_;
  349. }
  350. bool operator!=(BOOST_MEM_FN_NAME(cmf3) const & rhs) const
  351. {
  352. return f_ != rhs.f_;
  353. }
  354. };
  355. // mf4
  356. template<class R, class T, class A1, class A2, class A3, class A4 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf4)
  357. {
  358. public:
  359. typedef R result_type;
  360. private:
  361. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4))
  362. F f_;
  363. template<class U, class B1, class B2, class B3, class B4> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
  364. {
  365. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4);
  366. }
  367. template<class U, class B1, class B2, class B3, class B4> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
  368. {
  369. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4);
  370. }
  371. public:
  372. explicit BOOST_MEM_FN_NAME(mf4)(F f): f_(f) {}
  373. R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const
  374. {
  375. BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4);
  376. }
  377. template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const
  378. {
  379. U const * p = 0;
  380. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
  381. }
  382. #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  383. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
  384. {
  385. U const * p = 0;
  386. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
  387. }
  388. #endif
  389. R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const
  390. {
  391. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
  392. }
  393. bool operator==(BOOST_MEM_FN_NAME(mf4) const & rhs) const
  394. {
  395. return f_ == rhs.f_;
  396. }
  397. bool operator!=(BOOST_MEM_FN_NAME(mf4) const & rhs) const
  398. {
  399. return f_ != rhs.f_;
  400. }
  401. };
  402. // cmf4
  403. template<class R, class T, class A1, class A2, class A3, class A4 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf4)
  404. {
  405. public:
  406. typedef R result_type;
  407. private:
  408. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const)
  409. F f_;
  410. template<class U, class B1, class B2, class B3, class B4> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
  411. {
  412. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4);
  413. }
  414. template<class U, class B1, class B2, class B3, class B4> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
  415. {
  416. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4);
  417. }
  418. public:
  419. explicit BOOST_MEM_FN_NAME(cmf4)(F f): f_(f) {}
  420. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
  421. {
  422. U const * p = 0;
  423. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
  424. }
  425. R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const
  426. {
  427. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
  428. }
  429. bool operator==(BOOST_MEM_FN_NAME(cmf4) const & rhs) const
  430. {
  431. return f_ == rhs.f_;
  432. }
  433. bool operator!=(BOOST_MEM_FN_NAME(cmf4) const & rhs) const
  434. {
  435. return f_ != rhs.f_;
  436. }
  437. };
  438. // mf5
  439. template<class R, class T, class A1, class A2, class A3, class A4, class A5 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf5)
  440. {
  441. public:
  442. typedef R result_type;
  443. private:
  444. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5))
  445. F f_;
  446. template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
  447. {
  448. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5);
  449. }
  450. template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
  451. {
  452. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5);
  453. }
  454. public:
  455. explicit BOOST_MEM_FN_NAME(mf5)(F f): f_(f) {}
  456. R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
  457. {
  458. BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5);
  459. }
  460. template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
  461. {
  462. U const * p = 0;
  463. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
  464. }
  465. #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  466. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
  467. {
  468. U const * p = 0;
  469. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
  470. }
  471. #endif
  472. R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
  473. {
  474. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5);
  475. }
  476. bool operator==(BOOST_MEM_FN_NAME(mf5) const & rhs) const
  477. {
  478. return f_ == rhs.f_;
  479. }
  480. bool operator!=(BOOST_MEM_FN_NAME(mf5) const & rhs) const
  481. {
  482. return f_ != rhs.f_;
  483. }
  484. };
  485. // cmf5
  486. template<class R, class T, class A1, class A2, class A3, class A4, class A5 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf5)
  487. {
  488. public:
  489. typedef R result_type;
  490. private:
  491. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const)
  492. F f_;
  493. template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
  494. {
  495. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5);
  496. }
  497. template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
  498. {
  499. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5);
  500. }
  501. public:
  502. explicit BOOST_MEM_FN_NAME(cmf5)(F f): f_(f) {}
  503. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
  504. {
  505. U const * p = 0;
  506. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
  507. }
  508. R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
  509. {
  510. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5);
  511. }
  512. bool operator==(BOOST_MEM_FN_NAME(cmf5) const & rhs) const
  513. {
  514. return f_ == rhs.f_;
  515. }
  516. bool operator!=(BOOST_MEM_FN_NAME(cmf5) const & rhs) const
  517. {
  518. return f_ != rhs.f_;
  519. }
  520. };
  521. // mf6
  522. template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf6)
  523. {
  524. public:
  525. typedef R result_type;
  526. private:
  527. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6))
  528. F f_;
  529. template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
  530. {
  531. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6);
  532. }
  533. template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
  534. {
  535. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6);
  536. }
  537. public:
  538. explicit BOOST_MEM_FN_NAME(mf6)(F f): f_(f) {}
  539. R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
  540. {
  541. BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6);
  542. }
  543. template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
  544. {
  545. U const * p = 0;
  546. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
  547. }
  548. #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  549. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
  550. {
  551. U const * p = 0;
  552. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
  553. }
  554. #endif
  555. R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
  556. {
  557. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6);
  558. }
  559. bool operator==(BOOST_MEM_FN_NAME(mf6) const & rhs) const
  560. {
  561. return f_ == rhs.f_;
  562. }
  563. bool operator!=(BOOST_MEM_FN_NAME(mf6) const & rhs) const
  564. {
  565. return f_ != rhs.f_;
  566. }
  567. };
  568. // cmf6
  569. template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf6)
  570. {
  571. public:
  572. typedef R result_type;
  573. private:
  574. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const)
  575. F f_;
  576. template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
  577. {
  578. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6);
  579. }
  580. template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
  581. {
  582. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6);
  583. }
  584. public:
  585. explicit BOOST_MEM_FN_NAME(cmf6)(F f): f_(f) {}
  586. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
  587. {
  588. U const * p = 0;
  589. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
  590. }
  591. R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
  592. {
  593. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6);
  594. }
  595. bool operator==(BOOST_MEM_FN_NAME(cmf6) const & rhs) const
  596. {
  597. return f_ == rhs.f_;
  598. }
  599. bool operator!=(BOOST_MEM_FN_NAME(cmf6) const & rhs) const
  600. {
  601. return f_ != rhs.f_;
  602. }
  603. };
  604. // mf7
  605. template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf7)
  606. {
  607. public:
  608. typedef R result_type;
  609. private:
  610. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7))
  611. F f_;
  612. template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
  613. {
  614. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7);
  615. }
  616. template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
  617. {
  618. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7);
  619. }
  620. public:
  621. explicit BOOST_MEM_FN_NAME(mf7)(F f): f_(f) {}
  622. R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
  623. {
  624. BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7);
  625. }
  626. template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
  627. {
  628. U const * p = 0;
  629. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
  630. }
  631. #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  632. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
  633. {
  634. U const * p = 0;
  635. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
  636. }
  637. #endif
  638. R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
  639. {
  640. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
  641. }
  642. bool operator==(BOOST_MEM_FN_NAME(mf7) const & rhs) const
  643. {
  644. return f_ == rhs.f_;
  645. }
  646. bool operator!=(BOOST_MEM_FN_NAME(mf7) const & rhs) const
  647. {
  648. return f_ != rhs.f_;
  649. }
  650. };
  651. // cmf7
  652. template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf7)
  653. {
  654. public:
  655. typedef R result_type;
  656. private:
  657. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const)
  658. F f_;
  659. template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
  660. {
  661. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7);
  662. }
  663. template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
  664. {
  665. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7);
  666. }
  667. public:
  668. explicit BOOST_MEM_FN_NAME(cmf7)(F f): f_(f) {}
  669. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
  670. {
  671. U const * p = 0;
  672. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
  673. }
  674. R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
  675. {
  676. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
  677. }
  678. bool operator==(BOOST_MEM_FN_NAME(cmf7) const & rhs) const
  679. {
  680. return f_ == rhs.f_;
  681. }
  682. bool operator!=(BOOST_MEM_FN_NAME(cmf7) const & rhs) const
  683. {
  684. return f_ != rhs.f_;
  685. }
  686. };
  687. // mf8
  688. template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf8)
  689. {
  690. public:
  691. typedef R result_type;
  692. private:
  693. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8))
  694. F f_;
  695. template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
  696. {
  697. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
  698. }
  699. template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
  700. {
  701. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
  702. }
  703. public:
  704. explicit BOOST_MEM_FN_NAME(mf8)(F f): f_(f) {}
  705. R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
  706. {
  707. BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
  708. }
  709. template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
  710. {
  711. U const * p = 0;
  712. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
  713. }
  714. #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
  715. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
  716. {
  717. U const * p = 0;
  718. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
  719. }
  720. #endif
  721. R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
  722. {
  723. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
  724. }
  725. bool operator==(BOOST_MEM_FN_NAME(mf8) const & rhs) const
  726. {
  727. return f_ == rhs.f_;
  728. }
  729. bool operator!=(BOOST_MEM_FN_NAME(mf8) const & rhs) const
  730. {
  731. return f_ != rhs.f_;
  732. }
  733. };
  734. // cmf8
  735. template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf8)
  736. {
  737. public:
  738. typedef R result_type;
  739. private:
  740. BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const)
  741. F f_;
  742. template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
  743. {
  744. BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
  745. }
  746. template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
  747. {
  748. BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
  749. }
  750. public:
  751. explicit BOOST_MEM_FN_NAME(cmf8)(F f): f_(f) {}
  752. R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
  753. {
  754. BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
  755. }
  756. template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
  757. {
  758. U const * p = 0;
  759. BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
  760. }
  761. R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
  762. {
  763. BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
  764. }
  765. bool operator==(BOOST_MEM_FN_NAME(cmf8) const & rhs) const
  766. {
  767. return f_ == rhs.f_;
  768. }
  769. bool operator!=(BOOST_MEM_FN_NAME(cmf8) const & rhs) const
  770. {
  771. return f_ != rhs.f_;
  772. }
  773. };
  774. #undef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS