mem_fn_template.hpp 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047
  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