invoke.hpp 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
  1. // Copyright (C) 2012-2013 Vicente J. Botet Escriba
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // 2013/04 Vicente J. Botet Escriba
  6. // Provide implementation up to 9 parameters when BOOST_NO_CXX11_VARIADIC_TEMPLATES is defined.
  7. // Make use of Boost.Move
  8. // Make use of Boost.Tuple (movable)
  9. // 2012 Vicente J. Botet Escriba
  10. // Provide implementation _RET using bind when BOOST_NO_CXX11_HDR_FUNCTIONAL and BOOST_NO_SFINAE_EXPR are not defined
  11. // 2012 Vicente J. Botet Escriba
  12. // Adapt to boost libc++ implementation
  13. //===----------------------------------------------------------------------===//
  14. //
  15. // The LLVM Compiler Infrastructure
  16. //
  17. // This file is dual licensed under the MIT and the University of Illinois Open
  18. // Source Licenses. See LICENSE.TXT for details.
  19. //
  20. // The invoke code is based on the one from libcxx.
  21. //===----------------------------------------------------------------------===//
  22. #ifndef BOOST_THREAD_DETAIL_INVOKE_HPP
  23. #define BOOST_THREAD_DETAIL_INVOKE_HPP
  24. #include <boost/config.hpp>
  25. #include <boost/static_assert.hpp>
  26. #include <boost/thread/detail/move.hpp>
  27. #include <boost/core/enable_if.hpp>
  28. #include <boost/type_traits/is_base_of.hpp>
  29. #include <boost/type_traits/is_pointer.hpp>
  30. #include <boost/type_traits/is_member_function_pointer.hpp>
  31. #include <boost/type_traits/remove_reference.hpp>
  32. #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
  33. #include <functional>
  34. #endif
  35. namespace boost
  36. {
  37. namespace detail
  38. {
  39. #if ! defined(BOOST_NO_SFINAE_EXPR) && \
  40. ! defined(BOOST_NO_CXX11_DECLTYPE) && \
  41. ! defined(BOOST_NO_CXX11_DECLTYPE_N3276) && \
  42. ! defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES)
  43. #define BOOST_THREAD_PROVIDES_INVOKE
  44. #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  45. // bullets 1 and 2
  46. template <class Fp, class A0, class ...Args>
  47. inline auto
  48. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  49. -> decltype((boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...))
  50. {
  51. return (boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...);
  52. }
  53. template <class R, class Fp, class A0, class ...Args>
  54. inline auto
  55. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  56. -> decltype((boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...))
  57. {
  58. return (boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...);
  59. }
  60. template <class Fp, class A0, class ...Args>
  61. inline auto
  62. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  63. -> decltype(((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...))
  64. {
  65. return ((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...);
  66. }
  67. template <class R, class Fp, class A0, class ...Args>
  68. inline auto
  69. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  70. -> decltype(((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...))
  71. {
  72. return ((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...);
  73. }
  74. // bullets 3 and 4
  75. template <class Fp, class A0>
  76. inline auto
  77. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  78. -> decltype(boost::forward<A0>(a0).*f)
  79. {
  80. return boost::forward<A0>(a0).*f;
  81. }
  82. template <class Fp, class A0>
  83. inline auto
  84. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  85. -> decltype((*boost::forward<A0>(a0)).*f)
  86. {
  87. return (*boost::forward<A0>(a0)).*f;
  88. }
  89. template <class R, class Fp, class A0>
  90. inline auto
  91. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  92. -> decltype(boost::forward<A0>(a0).*f)
  93. {
  94. return boost::forward<A0>(a0).*f;
  95. }
  96. template <class R, class Fp, class A0>
  97. inline auto
  98. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  99. -> decltype((*boost::forward<A0>(a0)).*f)
  100. {
  101. return (*boost::forward<A0>(a0)).*f;
  102. }
  103. // bullet 5
  104. template <class R, class Fp, class ...Args>
  105. inline auto invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(Args) ...args)
  106. -> decltype(boost::forward<Fp>(f)(boost::forward<Args>(args)...))
  107. {
  108. return boost::forward<Fp>(f)(boost::forward<Args>(args)...);
  109. }
  110. template <class Fp, class ...Args>
  111. inline auto invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(Args) ...args)
  112. -> decltype(boost::forward<Fp>(f)(boost::forward<Args>(args)...))
  113. {
  114. return boost::forward<Fp>(f)(boost::forward<Args>(args)...);
  115. }
  116. #else // BOOST_NO_CXX11_VARIADIC_TEMPLATES
  117. // bullets 1 and 2
  118. template <class Fp, class A0>
  119. inline
  120. auto
  121. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  122. -> decltype((boost::forward<A0>(a0).*f)())
  123. {
  124. return (boost::forward<A0>(a0).*f)();
  125. }
  126. template <class R, class Fp, class A0>
  127. inline
  128. auto
  129. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  130. -> decltype((boost::forward<A0>(a0).*f)())
  131. {
  132. return (boost::forward<A0>(a0).*f)();
  133. }
  134. template <class Fp, class A0, class A1>
  135. inline
  136. auto
  137. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  138. -> decltype((boost::forward<A0>(a0).*f)(boost::forward<A1>(a1)))
  139. {
  140. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1));
  141. }
  142. template <class R, class Fp, class A0, class A1>
  143. inline
  144. auto
  145. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  146. -> decltype((boost::forward<A0>(a0).*f)(boost::forward<A1>(a1)))
  147. {
  148. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1));
  149. }
  150. template <class Fp, class A0, class A1, class A2>
  151. inline
  152. auto
  153. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  154. -> decltype((boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2)))
  155. {
  156. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  157. }
  158. template <class R, class Fp, class A0, class A1, class A2>
  159. inline
  160. auto
  161. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  162. -> decltype((boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2)))
  163. {
  164. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  165. }
  166. template <class Fp, class A0>
  167. inline
  168. auto
  169. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  170. -> decltype(((*boost::forward<A0>(a0)).*f)())
  171. {
  172. return ((*boost::forward<A0>(a0)).*f)();
  173. }
  174. template <class R, class Fp, class A0>
  175. inline
  176. auto
  177. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  178. -> decltype(((*boost::forward<A0>(a0)).*f)())
  179. {
  180. return ((*boost::forward<A0>(a0)).*f)();
  181. }
  182. template <class Fp, class A0, class A1>
  183. inline
  184. auto
  185. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  186. -> decltype(((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1)))
  187. {
  188. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1));
  189. }
  190. template <class R, class Fp, class A0, class A1>
  191. inline
  192. auto
  193. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  194. -> decltype(((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1)))
  195. {
  196. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1));
  197. }
  198. template <class Fp, class A0, class A1, class A2>
  199. inline
  200. auto
  201. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  202. -> decltype(((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2)))
  203. {
  204. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  205. }
  206. template <class R, class Fp, class A0, class A1, class A2>
  207. inline
  208. auto
  209. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  210. -> decltype(((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2)))
  211. {
  212. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  213. }
  214. // bullets 3 and 4
  215. template <class Fp, class A0>
  216. inline
  217. auto
  218. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  219. -> decltype(boost::forward<A0>(a0).*f)
  220. {
  221. return boost::forward<A0>(a0).*f;
  222. }
  223. template <class R, class Fp, class A0>
  224. inline
  225. auto
  226. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  227. -> decltype(boost::forward<A0>(a0).*f)
  228. {
  229. return boost::forward<A0>(a0).*f;
  230. }
  231. template <class Fp, class A0>
  232. inline
  233. auto
  234. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  235. -> decltype((*boost::forward<A0>(a0)).*f)
  236. {
  237. return (*boost::forward<A0>(a0)).*f;
  238. }
  239. template <class R, class Fp, class A0>
  240. inline
  241. auto
  242. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A0) a0)
  243. -> decltype((*boost::forward<A0>(a0)).*f)
  244. {
  245. return (*boost::forward<A0>(a0)).*f;
  246. }
  247. // bullet 5
  248. template <class Fp>
  249. inline
  250. auto invoke(BOOST_THREAD_RV_REF(Fp) f)
  251. -> decltype(boost::forward<Fp>(f)())
  252. {
  253. return boost::forward<Fp>(f)();
  254. }
  255. template <class Fp, class A1>
  256. inline
  257. auto invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1)
  258. -> decltype(boost::forward<Fp>(f)(boost::forward<A1>(a1)))
  259. {
  260. return boost::forward<Fp>(f)(boost::forward<A1>(a1));
  261. } template <class Fp, class A1, class A2>
  262. inline
  263. auto invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  264. -> decltype(boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2)))
  265. {
  266. return boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  267. }
  268. template <class Fp, class A1, class A2, class A3>
  269. inline
  270. auto invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  271. -> decltype(boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3)))
  272. {
  273. return boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  274. }
  275. template <class R, class Fp>
  276. inline
  277. auto invoke(BOOST_THREAD_RV_REF(Fp) f)
  278. -> decltype(boost::forward<Fp>(f)())
  279. {
  280. return boost::forward<Fp>(f)();
  281. }
  282. template <class R, class Fp, class A1>
  283. inline
  284. auto invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1)
  285. -> decltype(boost::forward<Fp>(f)(boost::forward<A1>(a1)))
  286. {
  287. return boost::forward<Fp>(f)(boost::forward<A1>(a1));
  288. }
  289. template <class R, class Fp, class A1, class A2>
  290. inline
  291. auto invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  292. -> decltype(boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2)))
  293. {
  294. return boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  295. }
  296. template <class R, class Fp, class A1, class A2, class A3>
  297. inline
  298. auto invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  299. -> decltype(boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3)))
  300. {
  301. return boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  302. }
  303. #endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
  304. #elif ! defined(BOOST_NO_SFINAE_EXPR) && \
  305. ! defined BOOST_NO_CXX11_HDR_FUNCTIONAL && \
  306. defined BOOST_MSVC
  307. template <class Ret, class Fp>
  308. inline
  309. Ret invoke(BOOST_THREAD_RV_REF(Fp) f)
  310. {
  311. return f();
  312. }
  313. template <class Ret, class Fp, class A1>
  314. inline
  315. Ret invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1)
  316. {
  317. return std::bind(boost::forward<Fp>(f), boost::forward<A1>(a1))();
  318. }
  319. template <class Ret, class Fp, class A1, class A2>
  320. inline
  321. Ret invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  322. {
  323. return std::bind(boost::forward<Fp>(f), boost::forward<A1>(a1), boost::forward<A2>(a2))();
  324. }
  325. template <class Ret, class Fp, class A1, class A2, class A3>
  326. inline
  327. Ret invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  328. {
  329. return std::bind(boost::forward<Fp>(f), boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3))();
  330. }
  331. #define BOOST_THREAD_PROVIDES_INVOKE_RET
  332. #elif ! defined BOOST_MSVC
  333. //!!!!! WARNING !!!!! THIS DOESN'T WORKS YET
  334. #define BOOST_THREAD_PROVIDES_INVOKE_RET
  335. #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  336. // bullet 1
  337. // (t1.*f)(t2, ..., tN) when f is a pointer to a member function of a class T and t1 is an object of
  338. // type T or a reference to an object of type T or a reference to an object of a type derived from T
  339. template <class Ret, class A, class A0, class ...Args>
  340. inline
  341. typename enable_if_c
  342. <
  343. is_base_of<A, typename remove_reference<A0>::type>::value,
  344. Ret
  345. >::type
  346. invoke(Ret (A::*f)(Args...), BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  347. {
  348. return (boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...);
  349. }
  350. template <class Ret, class A, class A0, class ...Args>
  351. inline
  352. typename enable_if_c
  353. <
  354. is_base_of<A, typename remove_reference<A0>::type>::value,
  355. Ret
  356. >::type
  357. invoke(Ret (A::*f)(Args...) const, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  358. {
  359. return (boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...);
  360. }
  361. template <class Ret, class A, class A0, class ...Args>
  362. inline
  363. typename enable_if_c
  364. <
  365. is_base_of<A, typename remove_reference<A0>::type>::value,
  366. Ret
  367. >::type
  368. invoke(Ret (A::*f)(Args...) volatile, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  369. {
  370. return (boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...);
  371. }
  372. template <class Ret, class A, class A0, class ...Args>
  373. inline
  374. typename enable_if_c
  375. <
  376. is_base_of<A, typename remove_reference<A0>::type>::value,
  377. Ret
  378. >::type
  379. invoke(Ret (A::*f)(Args...) const volatile, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  380. {
  381. return (boost::forward<A0>(a0).*f)(boost::forward<Args>(args)...);
  382. }
  383. // bullet 2
  384. // ((*t1).*f)(t2, ..., tN) when f is a pointer to a member function of a class T and t1 is not one of
  385. // the types described in the previous item;
  386. template <class Ret, class A, class A0, class ...Args>
  387. inline
  388. typename enable_if_c
  389. <
  390. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  391. Ret
  392. >::type
  393. invoke(Ret (A::*f)(Args...), BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  394. {
  395. return ((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...);
  396. }
  397. template <class Ret, class A, class A0, class ...Args>
  398. inline
  399. typename enable_if_c
  400. <
  401. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  402. Ret
  403. >::type
  404. invoke(Ret (A::*f)(Args...) const, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  405. {
  406. return ((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...);
  407. }
  408. template <class Ret, class A, class A0, class ...Args>
  409. inline
  410. typename enable_if_c
  411. <
  412. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  413. Ret
  414. >::type
  415. invoke(Ret (A::*f)(Args...) volatile, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  416. {
  417. return ((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...);
  418. }
  419. template <class Ret, class A, class A0, class ...Args>
  420. inline
  421. typename enable_if_c
  422. <
  423. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  424. Ret
  425. >::type
  426. invoke(Ret (A::*f)(Args...) const volatile, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(Args) ...args)
  427. {
  428. return ((*boost::forward<A0>(a0)).*f)(boost::forward<Args>(args)...);
  429. }
  430. // bullet 3
  431. // t1.*f when N == 1 and f is a pointer to member data of a class T and t1 is an object of type T or a
  432. // reference to an object of type T or a reference to an object of a type derived from T;
  433. // template <class Ret, class A, class A0>
  434. // inline
  435. // typename enable_if_c
  436. // <
  437. // is_base_of<A, typename remove_reference<A0>::type>::value,
  438. // typename detail::apply_cv<A0, A>::type&
  439. // >::type
  440. // invoke(Ret A::* f, BOOST_THREAD_RV_REF(A0) a0)
  441. // {
  442. // return boost::forward<A0>(a0).*f;
  443. // }
  444. // bullet 4
  445. // (*t1).*f when N == 1 and f is a pointer to member data of a class T and t1 is not one of the types
  446. //described in the previous item;
  447. // template <class A0, class Ret, bool>
  448. // struct d4th_helper
  449. // {
  450. // };
  451. //
  452. // template <class A0, class Ret>
  453. // struct d4th_helper<A0, Ret, true>
  454. // {
  455. // typedef typename apply_cv<decltype(*declval<A0>()), Ret>::type type;
  456. // };
  457. //
  458. // template <class Ret, class A, class A0>
  459. // inline
  460. // typename detail::4th_helper<A, Ret,
  461. // !is_base_of<A,
  462. // typename remove_reference<A0>::type
  463. // >::value
  464. // >::type&
  465. // invoke(Ret A::* f, BOOST_THREAD_RV_REF(A0) a0)
  466. // {
  467. // return (*boost::forward<A0>(a0)).*f;
  468. // }
  469. // template <class Ret, class A, class A0>
  470. // inline
  471. // typename enable_if_c
  472. // <
  473. // !is_base_of<A, typename remove_reference<A0>::type>::value,
  474. // typename detail::ref_return1<Ret A::*, A0>::type
  475. // >::type
  476. // invoke(Ret A::* f, BOOST_THREAD_RV_REF(A0) a0)
  477. // {
  478. // return (*boost::forward<A0>(a0)).*f;
  479. // }
  480. // bullet 5
  481. // f(t1, t2, ..., tN) in all other cases.
  482. template <class Ret, class Fp, class ...Args>
  483. inline Ret do_invoke(boost::false_type, BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(Args) ...args)
  484. {
  485. return boost::forward<Fp>(f)(boost::forward<Args>(args)...);
  486. }
  487. template <class Ret, class Fp, class ...Args>
  488. inline Ret do_invoke(boost::true_type, BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(Args) ...args)
  489. {
  490. return f(boost::forward<Args>(args)...);
  491. }
  492. template <class Ret, class Fp, class ...Args>
  493. inline
  494. typename disable_if_c
  495. <
  496. is_member_function_pointer<Fp>::value,
  497. Ret
  498. >::type
  499. invoke(BOOST_THREAD_RV_REF(Fp) f, BOOST_THREAD_RV_REF(Args) ...args)
  500. {
  501. return boost::detail::do_invoke<Ret>(boost::is_pointer<Fp>(), boost::forward<Fp>(f), boost::forward<Args>(args)...);
  502. }
  503. #else // BOOST_NO_CXX11_VARIADIC_TEMPLATES
  504. // bullet 1
  505. // (t1.*f)(t2, ..., tN) when f is a pointer to a member function of a class T and t1 is an object of
  506. // type T or a reference to an object of type T or a reference to an object of a type derived from T
  507. template <class Ret, class A, class A0>
  508. inline
  509. typename enable_if_c
  510. <
  511. is_base_of<A, typename remove_reference<A0>::type>::value,
  512. Ret
  513. >::type
  514. invoke(Ret (A::*f)(), A0& a0)
  515. {
  516. return (a0.*f)();
  517. }
  518. template <class Ret, class A, class A0>
  519. inline
  520. typename enable_if_c
  521. <
  522. is_base_of<A, typename remove_reference<A0>::type>::value,
  523. Ret
  524. >::type
  525. invoke(Ret (A::*f)(), A0* a0)
  526. {
  527. return ((*a0).*f)();
  528. }
  529. template <class Ret, class A, class A0, class A1>
  530. inline
  531. typename enable_if_c
  532. <
  533. is_base_of<A, typename remove_reference<A0>::type>::value,
  534. Ret
  535. >::type
  536. invoke(Ret (A::*f)(A1),
  537. A0& a0, BOOST_THREAD_RV_REF(A1) a1
  538. )
  539. {
  540. return (a0.*f)(boost::forward<A1>(a1));
  541. }
  542. template <class Ret, class A, class A0, class A1>
  543. inline
  544. typename enable_if_c
  545. <
  546. is_base_of<A, typename remove_reference<A0>::type>::value,
  547. Ret
  548. >::type
  549. invoke(Ret (A::*f)(A1), A0& a0, A1 a1)
  550. {
  551. return (a0.*f)(a1);
  552. }
  553. template <class Ret, class A, class A0, class A1>
  554. inline
  555. typename enable_if_c
  556. <
  557. is_base_of<A, typename remove_reference<A0>::type>::value,
  558. Ret
  559. >::type
  560. invoke(Ret (A::*f)(A1), A0* a0, BOOST_THREAD_RV_REF(A1) a1
  561. )
  562. {
  563. return (*(a0).*f)(boost::forward<A1>(a1));
  564. }
  565. template <class Ret, class A, class A0, class A1>
  566. inline
  567. typename enable_if_c
  568. <
  569. is_base_of<A, typename remove_reference<A0>::type>::value,
  570. Ret
  571. >::type
  572. invoke(Ret (A::*f)(A1), A0* a0, A1 a1)
  573. {
  574. return (*a0.*f)(a1);
  575. }
  576. template <class Ret, class A, class A0, class A1, class A2>
  577. inline
  578. typename enable_if_c
  579. <
  580. is_base_of<A, typename remove_reference<A0>::type>::value,
  581. Ret
  582. >::type
  583. invoke(Ret (A::*f)(A1, A2),
  584. A0& a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2
  585. )
  586. {
  587. return (a0.*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  588. }
  589. template <class Ret, class A, class A0, class A1, class A2>
  590. inline
  591. typename enable_if_c
  592. <
  593. is_base_of<A, typename remove_reference<A0>::type>::value,
  594. Ret
  595. >::type
  596. invoke(Ret (A::*f)(A1, A2), A0* a0, A1 a1, A2 a2)
  597. {
  598. return ((*a0).*f)(a1, a2);
  599. }
  600. template <class Ret, class A, class A0, class A1, class A2, class A3>
  601. inline
  602. typename enable_if_c
  603. <
  604. is_base_of<A, typename remove_reference<A0>::type>::value,
  605. Ret
  606. >::type
  607. invoke(Ret (A::*f)(A1, A2, A3),
  608. A0& a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  609. {
  610. return (a0.*f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  611. }
  612. template <class Ret, class A, class A0, class A1, class A2, class A3>
  613. inline
  614. typename enable_if_c
  615. <
  616. is_base_of<A, typename remove_reference<A0>::type>::value,
  617. Ret
  618. >::type
  619. invoke(Ret (A::*f)(A1, A2, A3), A0* a0, A1 a1, A2 a2, A3 a3)
  620. {
  621. return ((*a0).*f)(a1, a2, a3);
  622. }
  623. ///
  624. template <class Ret, class A, class A0>
  625. inline
  626. typename enable_if_c
  627. <
  628. is_base_of<A, typename remove_reference<A0>::type>::value,
  629. Ret
  630. >::type
  631. invoke(Ret (A::*f)() const, A0 const& a0)
  632. {
  633. return (a0.*f)();
  634. }
  635. template <class Ret, class A, class A0>
  636. inline
  637. typename enable_if_c
  638. <
  639. is_base_of<A, typename remove_reference<A0>::type>::value,
  640. Ret
  641. >::type
  642. invoke(Ret (A::*f)() const, A0 const* a0)
  643. {
  644. return ((*a0).*f)();
  645. }
  646. template <class Ret, class A, class A0, class A1>
  647. inline
  648. typename enable_if_c
  649. <
  650. is_base_of<A, typename remove_reference<A0>::type>::value,
  651. Ret
  652. >::type
  653. invoke(Ret (A::*f)(A1) const, A0 const& a0, BOOST_THREAD_RV_REF(A1) a1)
  654. {
  655. return (a0.*f)(boost::forward<A1>(a1));
  656. }
  657. template <class Ret, class A, class A0, class A1>
  658. inline
  659. typename enable_if_c
  660. <
  661. is_base_of<A, typename remove_reference<A0>::type>::value,
  662. Ret
  663. >::type
  664. invoke(Ret (A::*f)(A1) const, A0 const* a0, BOOST_THREAD_RV_REF(A1) a1)
  665. {
  666. return ((*a0).*f)(boost::forward<A1>(a1));
  667. }
  668. template <class Ret, class A, class A0, class A1>
  669. inline
  670. typename enable_if_c
  671. <
  672. is_base_of<A, typename remove_reference<A0>::type>::value,
  673. Ret
  674. >::type
  675. invoke(Ret (A::*f)(A1) const, A0 const& a0, A1 a1)
  676. {
  677. return (a0.*f)(a1);
  678. }
  679. template <class Ret, class A, class A0, class A1, class A2>
  680. inline
  681. typename enable_if_c
  682. <
  683. is_base_of<A, typename remove_reference<A0>::type>::value,
  684. Ret
  685. >::type
  686. invoke(Ret (A::*f)(A1, A2) const,
  687. A0 const& a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2
  688. )
  689. {
  690. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2)
  691. );
  692. }
  693. template <class Ret, class A, class A0, class A1, class A2>
  694. inline
  695. typename enable_if_c
  696. <
  697. is_base_of<A, typename remove_reference<A0>::type>::value,
  698. Ret
  699. >::type
  700. invoke(Ret (A::*f)(A1, A2) const, A0 const& a0, A1 a1, A2 a2)
  701. {
  702. return (a0.*f)(a1, a2);
  703. }
  704. template <class Ret, class A, class A0, class A1, class A2, class A3>
  705. inline
  706. typename enable_if_c
  707. <
  708. is_base_of<A, typename remove_reference<A0>::type>::value,
  709. Ret
  710. >::type
  711. invoke(Ret (A::*f)(A1, A2, A3) const,
  712. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3
  713. )
  714. {
  715. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  716. }
  717. template <class Ret, class A, class A0, class A1, class A2, class A3>
  718. inline
  719. typename enable_if_c
  720. <
  721. is_base_of<A, typename remove_reference<A0>::type>::value,
  722. Ret
  723. >::type
  724. invoke(Ret (A::*f)(A1, A2, A3) const, A0 a0, A1 a1, A2 a2, A3 a3)
  725. {
  726. return (a0.*f)(a1, a2, a3);
  727. }
  728. ///
  729. template <class Ret, class A, class A0>
  730. inline
  731. typename enable_if_c
  732. <
  733. is_base_of<A, typename remove_reference<A0>::type>::value,
  734. Ret
  735. >::type
  736. invoke(Ret (A::*f)() volatile, BOOST_THREAD_RV_REF(A0) a0)
  737. {
  738. return (boost::forward<A0>(a0).*f)();
  739. }
  740. template <class Ret, class A, class A0, class A1>
  741. inline
  742. typename enable_if_c
  743. <
  744. is_base_of<A, typename remove_reference<A0>::type>::value,
  745. Ret
  746. >::type
  747. invoke(Ret (A::*f)(A1) volatile, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  748. {
  749. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1));
  750. }
  751. template <class Ret, class A, class A0, class A1>
  752. inline
  753. typename enable_if_c
  754. <
  755. is_base_of<A, typename remove_reference<A0>::type>::value,
  756. Ret
  757. >::type
  758. invoke(Ret (A::*f)(A1) volatile, A0 a0, A1 a1)
  759. {
  760. return (a0.*f)(a1);
  761. }
  762. template <class Ret, class A, class A0, class A1, class A2>
  763. inline
  764. typename enable_if_c
  765. <
  766. is_base_of<A, typename remove_reference<A0>::type>::value,
  767. Ret
  768. >::type
  769. invoke(Ret (A::*f)(A1, A2) volatile,
  770. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  771. {
  772. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  773. }
  774. template <class Ret, class A, class A0, class A1, class A2>
  775. inline
  776. typename enable_if_c
  777. <
  778. is_base_of<A, typename remove_reference<A0>::type>::value,
  779. Ret
  780. >::type
  781. invoke(Ret (A::*f)(A1, A2) volatile, A0 a0, A1 a1, A2 a2 )
  782. {
  783. return (a0.*f)(a1, a2);
  784. }
  785. template <class Ret, class A, class A0, class A1, class A2, class A3>
  786. inline
  787. typename enable_if_c
  788. <
  789. is_base_of<A, typename remove_reference<A0>::type>::value,
  790. Ret
  791. >::type
  792. invoke(Ret (A::*f)(A1, A2, A3) volatile,
  793. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3
  794. )
  795. {
  796. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  797. }
  798. template <class Ret, class A, class A0, class A1, class A2, class A3>
  799. inline
  800. typename enable_if_c
  801. <
  802. is_base_of<A, typename remove_reference<A0>::type>::value,
  803. Ret
  804. >::type
  805. invoke(Ret (A::*f)(A1, A2, A3) volatile, A0 a0, A1 a1, A2 a2, A3 a3)
  806. {
  807. return (a0.*f)(a1, a2, a3);
  808. }
  809. ///
  810. template <class Ret, class A, class A0>
  811. inline
  812. typename enable_if_c
  813. <
  814. is_base_of<A, typename remove_reference<A0>::type>::value,
  815. Ret
  816. >::type
  817. invoke(Ret (A::*f)() const volatile, BOOST_THREAD_RV_REF(A0) a0)
  818. {
  819. return (boost::forward<A0>(a0).*f)();
  820. }
  821. template <class Ret, class A, class A0, class A1>
  822. inline
  823. typename enable_if_c
  824. <
  825. is_base_of<A, typename remove_reference<A0>::type>::value,
  826. Ret
  827. >::type
  828. invoke(Ret (A::*f)(A1) const volatile, BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  829. {
  830. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1));
  831. }
  832. template <class Ret, class A, class A0, class A1>
  833. inline
  834. typename enable_if_c
  835. <
  836. is_base_of<A, typename remove_reference<A0>::type>::value,
  837. Ret
  838. >::type
  839. invoke(Ret (A::*f)(A1) const volatile, A0 a0, A1 a1)
  840. {
  841. return (a0.*f)(a1);
  842. }
  843. template <class Ret, class A, class A0, class A1, class A2>
  844. inline
  845. typename enable_if_c
  846. <
  847. is_base_of<A, typename remove_reference<A0>::type>::value,
  848. Ret
  849. >::type
  850. invoke(Ret (A::*f)(A1, A2) const volatile,
  851. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2
  852. )
  853. {
  854. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  855. }
  856. template <class Ret, class A, class A0, class A1, class A2>
  857. inline
  858. typename enable_if_c
  859. <
  860. is_base_of<A, typename remove_reference<A0>::type>::value,
  861. Ret
  862. >::type
  863. invoke(Ret (A::*f)(A1, A2) const volatile,
  864. A0 a0, A1 a1, A2 a2
  865. )
  866. {
  867. return (a0.*f)(a1, a2);
  868. }
  869. template <class Ret, class A, class A0, class A1, class A2, class A3>
  870. inline
  871. typename enable_if_c
  872. <
  873. is_base_of<A, typename remove_reference<A0>::type>::value,
  874. Ret
  875. >::type
  876. invoke(Ret (A::*f)(A1, A2, A3) const volatile,
  877. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3
  878. )
  879. {
  880. return (boost::forward<A0>(a0).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  881. }
  882. template <class Ret, class A, class A0, class A1, class A2, class A3>
  883. inline
  884. typename enable_if_c
  885. <
  886. is_base_of<A, typename remove_reference<A0>::type>::value,
  887. Ret
  888. >::type
  889. invoke(Ret (A::*f)(A1, A2, A3) const volatile,
  890. A0 a0, A1 a1, A2 a2, A3 a3
  891. )
  892. {
  893. return (a0.*f)(a1, a2, a3);
  894. }
  895. // bullet 2
  896. // ((*t1).*f)(t2, ..., tN) when f is a pointer to a member function of a class T and t1 is not one of
  897. // the types described in the previous item;
  898. template <class Ret, class A, class A0>
  899. inline
  900. typename enable_if_c
  901. <
  902. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  903. Ret
  904. >::type
  905. invoke(Ret (A::*f)(), BOOST_THREAD_RV_REF(A0) a0)
  906. {
  907. return ((*boost::forward<A0>(a0)).*f)();
  908. }
  909. template <class Ret, class A, class A0, class A1>
  910. inline
  911. typename enable_if_c
  912. <
  913. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  914. Ret
  915. >::type
  916. invoke(Ret (A::*f)(A1), BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  917. {
  918. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1));
  919. }
  920. template <class Ret, class A, class A0, class A1>
  921. inline
  922. typename enable_if_c
  923. <
  924. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  925. Ret
  926. >::type
  927. invoke(Ret (A::*f)(A1), A0 a0, A1 a1)
  928. {
  929. return ((*a0).*f)(a1);
  930. }
  931. template <class Ret, class A, class A0, class A1, class A2>
  932. inline
  933. typename enable_if_c
  934. <
  935. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  936. Ret
  937. >::type
  938. invoke(Ret (A::*f)(A1, BOOST_THREAD_RV_REF(A2)),
  939. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  940. {
  941. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  942. }
  943. template <class Ret, class A, class A0, class A1, class A2>
  944. inline
  945. typename enable_if_c
  946. <
  947. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  948. Ret
  949. >::type
  950. invoke(Ret (A::*f)(A1, A2), A0 a0, A1 a1, A2 a2)
  951. {
  952. return ((*a0).*f)(a1, a2);
  953. }
  954. template <class Ret, class A, class A0, class A1, class A2, class A3>
  955. inline
  956. typename enable_if_c
  957. <
  958. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  959. Ret
  960. >::type
  961. invoke(Ret (A::*f)(A1, BOOST_THREAD_RV_REF(A2), BOOST_THREAD_RV_REF(A3)),
  962. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  963. {
  964. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3)
  965. );
  966. }
  967. template <class Ret, class A, class A0, class A1, class A2, class A3>
  968. inline
  969. typename enable_if_c
  970. <
  971. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  972. Ret
  973. >::type
  974. invoke(Ret (A::*f)(A1, A2, A3), A0 a0, A1 a1, A2 a2, A3 a3)
  975. {
  976. return ((*a0).*f)(a1, a2, a3);
  977. }
  978. ///
  979. template <class Ret, class A, class A0>
  980. inline
  981. typename enable_if_c
  982. <
  983. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  984. Ret
  985. >::type
  986. invoke(Ret (A::*f)() const, BOOST_THREAD_RV_REF(A0) a0)
  987. {
  988. return ((*boost::forward<A0>(a0)).*f)();
  989. }
  990. template <class Ret, class A, class A0, class A1>
  991. inline
  992. typename enable_if_c
  993. <
  994. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  995. Ret
  996. >::type
  997. invoke(Ret (A::*f)(A1) const,
  998. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  999. {
  1000. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1));
  1001. }
  1002. template <class Ret, class A, class A0, class A1>
  1003. inline
  1004. typename enable_if_c
  1005. <
  1006. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1007. Ret
  1008. >::type
  1009. invoke(Ret (A::*f)(A1) const, BOOST_THREAD_RV_REF(A0) a0, A1 a1)
  1010. {
  1011. return ((*boost::forward<A0>(a0)).*f)(a1);
  1012. }
  1013. template <class Ret, class A, class A0, class A1>
  1014. inline
  1015. typename enable_if_c
  1016. <
  1017. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1018. Ret
  1019. >::type
  1020. invoke(Ret (A::*f)(A1) const, A0 a0, A1 a1)
  1021. {
  1022. return ((*a0).*f)(a1);
  1023. }
  1024. template <class Ret, class A, class A0, class A1, class A2>
  1025. inline
  1026. typename enable_if_c
  1027. <
  1028. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1029. Ret
  1030. >::type
  1031. invoke(Ret (A::*f)(A1, A2) const,
  1032. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  1033. {
  1034. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  1035. }
  1036. template <class Ret, class A, class A0, class A1, class A2>
  1037. inline
  1038. typename enable_if_c
  1039. <
  1040. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1041. Ret
  1042. >::type
  1043. invoke(Ret (A::*f)(A1, A2) const, A0 a0, A1 a1, A2 a2)
  1044. {
  1045. return ((*a0).*f)(a1, a2);
  1046. }
  1047. template <class Ret, class A, class A0, class A1, class A2, class A3>
  1048. inline
  1049. typename enable_if_c
  1050. <
  1051. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1052. Ret
  1053. >::type
  1054. invoke(Ret (A::*f)(A1, A2, A3) const,
  1055. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  1056. {
  1057. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  1058. }
  1059. template <class Ret, class A, class A0, class A1, class A2, class A3>
  1060. inline
  1061. typename enable_if_c
  1062. <
  1063. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1064. Ret
  1065. >::type
  1066. invoke(Ret (A::*f)(A1, A2, A3) const,
  1067. A0 a0, A1 a1, A2 a2, A3 a3)
  1068. {
  1069. return ((*a0).*f)(a1, a2, a3);
  1070. }
  1071. ///
  1072. template <class Ret, class A, class A0>
  1073. inline
  1074. typename enable_if_c
  1075. <
  1076. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1077. Ret
  1078. >::type
  1079. invoke(Ret (A::*f)() volatile, BOOST_THREAD_RV_REF(A0) a0)
  1080. {
  1081. return ((*boost::forward<A0>(a0)).*f)();
  1082. }
  1083. template <class Ret, class A, class A0, class A1>
  1084. inline
  1085. typename enable_if_c
  1086. <
  1087. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1088. Ret
  1089. >::type
  1090. invoke(Ret (A::*f)(A1) volatile,
  1091. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  1092. {
  1093. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1));
  1094. }
  1095. template <class Ret, class A, class A0, class A1>
  1096. inline
  1097. typename enable_if_c
  1098. <
  1099. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1100. Ret
  1101. >::type
  1102. invoke(Ret (A::*f)(A1) volatile, A0 a0, A1 a1)
  1103. {
  1104. return ((*a0).*f)(a1);
  1105. }
  1106. template <class Ret, class A, class A0, class A1, class A2>
  1107. inline
  1108. typename enable_if_c
  1109. <
  1110. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1111. Ret
  1112. >::type
  1113. invoke(Ret (A::*f)(A1, A2) volatile,
  1114. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  1115. {
  1116. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  1117. }
  1118. template <class Ret, class A, class A0, class A1, class A2>
  1119. inline
  1120. typename enable_if_c
  1121. <
  1122. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1123. Ret
  1124. >::type
  1125. invoke(Ret (A::*f)(A1, A2) volatile, A0 a0, A1 a1, A2 a2)
  1126. {
  1127. return ((*a0).*f)(a1, a2);
  1128. }
  1129. template <class Ret, class A, class A0, class A1, class A2, class A3>
  1130. inline
  1131. typename enable_if_c
  1132. <
  1133. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1134. Ret
  1135. >::type
  1136. invoke(Ret (A::*f)(A1, A2, A3) volatile,
  1137. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  1138. {
  1139. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  1140. }
  1141. template <class Ret, class A, class A0, class A1, class A2, class A3>
  1142. inline
  1143. typename enable_if_c
  1144. <
  1145. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1146. Ret
  1147. >::type
  1148. invoke(Ret (A::*f)(A1, A2, A3) volatile, A0 a0, A1 a1, A2 a2, A3 a3)
  1149. {
  1150. return ((*a0).*f)(a1, a2, a3);
  1151. }
  1152. ///
  1153. template <class Ret, class A, class A0>
  1154. inline
  1155. typename enable_if_c
  1156. <
  1157. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1158. Ret
  1159. >::type
  1160. invoke(Ret (A::*f)() const volatile, BOOST_THREAD_RV_REF(A0) a0)
  1161. {
  1162. return ((*boost::forward<A0>(a0)).*f)();
  1163. }
  1164. template <class Ret, class A, class A0>
  1165. inline
  1166. typename enable_if_c
  1167. <
  1168. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1169. Ret
  1170. >::type
  1171. invoke(Ret (A::*f)() const volatile, A0 a0)
  1172. {
  1173. return ((*a0).*f)();
  1174. }
  1175. template <class Ret, class A, class A0, class A1>
  1176. inline
  1177. typename enable_if_c
  1178. <
  1179. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1180. Ret
  1181. >::type
  1182. invoke(Ret (A::*f)(A1) const volatile,
  1183. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1)
  1184. {
  1185. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1));
  1186. }
  1187. template <class Ret, class A, class A0, class A1>
  1188. inline
  1189. typename enable_if_c
  1190. <
  1191. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1192. Ret
  1193. >::type
  1194. invoke(Ret (A::*f)(A1) const volatile, A0 a0, A1 a1)
  1195. {
  1196. return ((*a0).*f)(a1);
  1197. }
  1198. template <class Ret, class A, class A0, class A1, class A2>
  1199. inline
  1200. typename enable_if_c
  1201. <
  1202. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1203. Ret
  1204. >::type
  1205. invoke(Ret (A::*f)(A1, A2) const volatile,
  1206. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  1207. {
  1208. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  1209. }
  1210. template <class Ret, class A, class A0, class A1, class A2>
  1211. inline
  1212. typename enable_if_c
  1213. <
  1214. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1215. Ret
  1216. >::type
  1217. invoke(Ret (A::*f)(A1, A2) const volatile,
  1218. A0 a0, A1 a1, A2 a2)
  1219. {
  1220. return ((*a0).*f)(a1, a2);
  1221. }
  1222. template <class Ret, class A, class A0, class A1, class A2, class A3>
  1223. inline
  1224. typename enable_if_c
  1225. <
  1226. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1227. Ret
  1228. >::type
  1229. invoke(Ret (A::*f)(A1, A2, A3) const volatile,
  1230. BOOST_THREAD_RV_REF(A0) a0, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  1231. {
  1232. return ((*boost::forward<A0>(a0)).*f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  1233. }
  1234. template <class Ret, class A, class A0, class A1, class A2, class A3>
  1235. inline
  1236. typename enable_if_c
  1237. <
  1238. ! is_base_of<A, typename remove_reference<A0>::type>::value,
  1239. Ret
  1240. >::type
  1241. invoke(Ret (A::*f)(A1, A2, A3) const volatile,
  1242. A0 a0, A1 a1, A2 a2, A3 a3)
  1243. {
  1244. return ((*a0).*f)(a1, a2, a3);
  1245. }
  1246. // bullet 3
  1247. // t1.*f when N == 1 and f is a pointer to member data of a class T and t1 is an object of type T or a
  1248. // reference to an object of type T or a reference to an object of a type derived from T;
  1249. // template <class Ret, class A, class A0>
  1250. // inline
  1251. // typename enable_if_c
  1252. // <
  1253. // is_base_of<A, typename remove_reference<A0>::type>::value,
  1254. // typename detail::apply_cv<A0, A>::type&
  1255. // >::type
  1256. // invoke(Ret A::* f, BOOST_THREAD_RV_REF(A0) a0)
  1257. // {
  1258. // return boost::forward<A0>(a0).*f;
  1259. // }
  1260. // bullet 4
  1261. // (*t1).*f when N == 1 and f is a pointer to member data of a class T and t1 is not one of the types
  1262. //described in the previous item;
  1263. // template <class A0, class Ret, bool>
  1264. // struct d4th_helper
  1265. // {
  1266. // };
  1267. //
  1268. // template <class A0, class Ret>
  1269. // struct d4th_helper<A0, Ret, true>
  1270. // {
  1271. // typedef typename apply_cv<decltype(*declval<A0>()), Ret>::type type;
  1272. // };
  1273. //
  1274. // template <class Ret, class A, class A0>
  1275. // inline
  1276. // typename detail::4th_helper<A, Ret,
  1277. // !is_base_of<A,
  1278. // typename remove_reference<A0>::type
  1279. // >::value
  1280. // >::type&
  1281. // invoke(Ret A::* f, BOOST_THREAD_RV_REF(A0) a0)
  1282. // {
  1283. // return (*boost::forward<A0>(a0)).*f;
  1284. // }
  1285. // template <class Ret, class A, class A0>
  1286. // inline
  1287. // typename enable_if_c
  1288. // <
  1289. // !is_base_of<A, typename remove_reference<A0>::type>::value,
  1290. // typename detail::ref_return1<Ret A::*, A0>::type
  1291. // >::type
  1292. // invoke(Ret A::* f, BOOST_THREAD_RV_REF(A0) a0)
  1293. // {
  1294. // return (*boost::forward<A0>(a0)).*f;
  1295. // }
  1296. // bullet 5
  1297. // f(t1, t2, ..., tN) in all other cases.
  1298. template <class Ret, class Fp>
  1299. inline Ret do_invoke(boost::false_type, BOOST_THREAD_FWD_REF(Fp) f)
  1300. {
  1301. return boost::forward<Fp>(f)();
  1302. }
  1303. template <class Ret, class Fp>
  1304. inline Ret do_invoke(boost::true_type, BOOST_THREAD_FWD_REF(Fp) f)
  1305. {
  1306. return f();
  1307. }
  1308. template <class Ret, class Fp>
  1309. inline
  1310. typename disable_if_c
  1311. <
  1312. is_member_function_pointer<Fp>::value,
  1313. Ret
  1314. >::type
  1315. invoke(BOOST_THREAD_FWD_REF(Fp) f)
  1316. {
  1317. return boost::detail::do_invoke<Ret>(boost::is_pointer<Fp>(), boost::forward<Fp>(f));
  1318. }
  1319. template <class Ret, class Fp, class A1>
  1320. inline Ret do_invoke(boost::false_type, BOOST_THREAD_FWD_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1)
  1321. {
  1322. return boost::forward<Fp>(f)(boost::forward<A1>(a1));
  1323. }
  1324. template <class Ret, class Fp, class A1>
  1325. inline Ret do_invoke(boost::true_type, BOOST_THREAD_FWD_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1)
  1326. {
  1327. return f(boost::forward<A1>(a1));
  1328. }
  1329. template <class Ret, class Fp, class A1>
  1330. inline
  1331. typename disable_if_c
  1332. <
  1333. is_member_function_pointer<Fp>::value,
  1334. Ret
  1335. >::type
  1336. invoke(BOOST_THREAD_FWD_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1)
  1337. {
  1338. return boost::detail::do_invoke<Ret>(boost::is_pointer<Fp>(), boost::forward<Fp>(f), boost::forward<A1>(a1));
  1339. }
  1340. template <class Ret, class Fp, class A1, class A2>
  1341. inline Ret do_invoke(boost::false_type, BOOST_THREAD_FWD_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  1342. {
  1343. return boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2));
  1344. }
  1345. template <class Ret, class Fp, class A1, class A2>
  1346. inline Ret do_invoke(boost::true_type, BOOST_THREAD_FWD_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  1347. {
  1348. return f(boost::forward<A1>(a1), boost::forward<A2>(a2));
  1349. }
  1350. template <class Ret, class Fp, class A1, class A2>
  1351. inline
  1352. typename disable_if_c
  1353. <
  1354. is_member_function_pointer<Fp>::value,
  1355. Ret
  1356. >::type
  1357. invoke(BOOST_THREAD_FWD_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  1358. {
  1359. return boost::detail::do_invoke<Ret>(boost::is_pointer<Fp>(), boost::forward<Fp>(f), boost::forward<A1>(a1), boost::forward<A2>(a2));
  1360. }
  1361. template <class Ret, class Fp, class A1, class A2, class A3>
  1362. inline Ret do_invoke(boost::false_type, BOOST_THREAD_FWD_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  1363. {
  1364. return boost::forward<Fp>(f)(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  1365. }
  1366. template <class Ret, class Fp, class A1, class A2, class A3>
  1367. inline Ret do_invoke(boost::true_type, BOOST_THREAD_FWD_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  1368. {
  1369. return f(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  1370. }
  1371. template <class Ret, class Fp, class A1, class A2, class A3>
  1372. inline
  1373. typename disable_if_c
  1374. <
  1375. is_member_function_pointer<Fp>::value,
  1376. Ret
  1377. >::type
  1378. invoke(BOOST_THREAD_FWD_REF(Fp) f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  1379. {
  1380. return boost::detail::do_invoke<Ret>(boost::is_pointer<Fp>(), boost::forward<Fp>(f), boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  1381. }
  1382. template <class Ret, class Fp, class A1>
  1383. inline Ret do_invoke(boost::false_type, BOOST_THREAD_FWD_REF(Fp) f, A1 a1)
  1384. {
  1385. return boost::forward<Fp>(f)(a1);
  1386. }
  1387. template <class Ret, class Fp, class A1>
  1388. inline Ret do_invoke(boost::true_type, BOOST_THREAD_FWD_REF(Fp) f, A1 a1)
  1389. {
  1390. return f(a1);
  1391. }
  1392. template <class Ret, class Fp, class A1>
  1393. inline
  1394. typename disable_if_c
  1395. <
  1396. is_member_function_pointer<Fp>::value,
  1397. Ret
  1398. >::type
  1399. invoke(BOOST_THREAD_FWD_REF(Fp) f, A1 a1)
  1400. {
  1401. return boost::detail::do_invoke<Ret>(boost::is_pointer<Fp>(), boost::forward<Fp>(f), a1);
  1402. }
  1403. template <class Ret, class Fp, class A1, class A2>
  1404. inline Ret do_invoke(boost::false_type, BOOST_THREAD_FWD_REF(Fp) f, A1 a1, A2 a2)
  1405. {
  1406. return boost::forward<Fp>(f)(a1, a2);
  1407. }
  1408. template <class Ret, class Fp, class A1, class A2>
  1409. inline Ret do_invoke(boost::true_type, BOOST_THREAD_FWD_REF(Fp) f, A1 a1, A2 a2)
  1410. {
  1411. return f(a1, a2);
  1412. }
  1413. template <class Ret, class Fp, class A1, class A2>
  1414. inline
  1415. typename disable_if_c
  1416. <
  1417. is_member_function_pointer<Fp>::value,
  1418. Ret
  1419. >::type
  1420. invoke(BOOST_THREAD_FWD_REF(Fp) f, A1 a1, A2 a2)
  1421. {
  1422. return boost::detail::do_invoke<Ret>(boost::is_pointer<Fp>(), boost::forward<Fp>(f), a1, a2);
  1423. }
  1424. template <class Ret, class Fp, class A1, class A2, class A3>
  1425. inline Ret do_invoke(boost::false_type, BOOST_THREAD_FWD_REF(Fp) f, A1 a1, A2 a2, A3 a3)
  1426. {
  1427. return boost::forward<Fp>(f)(a1, a2, a3);
  1428. }
  1429. template <class Ret, class Fp, class A1, class A2, class A3>
  1430. inline Ret do_invoke(boost::true_type, BOOST_THREAD_FWD_REF(Fp) f, A1 a1, A2 a2, A3 a3)
  1431. {
  1432. return f(a1, a2, a3);
  1433. }
  1434. template <class Ret, class Fp, class A1, class A2, class A3>
  1435. inline
  1436. typename disable_if_c
  1437. <
  1438. is_member_function_pointer<Fp>::value,
  1439. Ret
  1440. >::type
  1441. invoke(BOOST_THREAD_FWD_REF(Fp) f, A1 a1, A2 a2, A3 a3)
  1442. {
  1443. return boost::detail::do_invoke<Ret>(boost::is_pointer<Fp>(), boost::forward<Fp>(f), a1, a2, a3);
  1444. }
  1445. ///
  1446. template <class Ret, class Fp>
  1447. inline
  1448. typename disable_if_c
  1449. <
  1450. is_member_function_pointer<Fp>::value,
  1451. Ret
  1452. >::type
  1453. invoke(Fp &f)
  1454. {
  1455. return f();
  1456. }
  1457. template <class Ret, class Fp, class A1>
  1458. inline
  1459. typename disable_if_c
  1460. <
  1461. is_member_function_pointer<Fp>::value,
  1462. Ret
  1463. >::type
  1464. invoke(Fp &f, BOOST_THREAD_RV_REF(A1) a1)
  1465. {
  1466. return f(boost::forward<A1>(a1));
  1467. }
  1468. template <class Ret, class Fp, class A1>
  1469. inline
  1470. typename disable_if_c
  1471. <
  1472. is_member_function_pointer<Fp>::value,
  1473. Ret
  1474. >::type
  1475. invoke(Fp &f, A1 a1)
  1476. {
  1477. return f(a1);
  1478. }
  1479. template <class Ret, class Fp, class A1, class A2>
  1480. inline
  1481. typename disable_if_c
  1482. <
  1483. is_member_function_pointer<Fp>::value,
  1484. Ret
  1485. >::type
  1486. invoke(Fp &f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2)
  1487. {
  1488. return f(boost::forward<A1>(a1), boost::forward<A2>(a2));
  1489. }
  1490. template <class Ret, class Fp, class A1, class A2>
  1491. inline
  1492. typename disable_if_c
  1493. <
  1494. is_member_function_pointer<Fp>::value,
  1495. Ret
  1496. >::type
  1497. invoke(Fp &f, A1 a1, A2 a2)
  1498. {
  1499. return f(a1, a2);
  1500. }
  1501. template <class Ret, class Fp, class A1, class A2, class A3>
  1502. inline
  1503. typename disable_if_c
  1504. <
  1505. is_member_function_pointer<Fp>::value,
  1506. Ret
  1507. >::type
  1508. invoke(Fp &f, BOOST_THREAD_RV_REF(A1) a1, BOOST_THREAD_RV_REF(A2) a2, BOOST_THREAD_RV_REF(A3) a3)
  1509. {
  1510. return f(boost::forward<A1>(a1), boost::forward<A2>(a2), boost::forward<A3>(a3));
  1511. }
  1512. template <class Ret, class Fp, class A1, class A2, class A3>
  1513. inline
  1514. typename disable_if_c
  1515. <
  1516. is_member_function_pointer<Fp>::value,
  1517. Ret
  1518. >::type
  1519. invoke(Fp &f, A1 a1, A2 a2, A3 a3)
  1520. {
  1521. return f(a1, a2, a3);
  1522. }
  1523. ///
  1524. #endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
  1525. #endif // all
  1526. }
  1527. }
  1528. #endif // header