handler_type_requirements.hpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. //
  2. // detail/handler_type_requirements.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP
  11. #define BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. // Older versions of gcc have difficulty compiling the sizeof expressions where
  17. // we test the handler type requirements. We'll disable checking of handler type
  18. // requirements for those compilers, but otherwise enable it by default.
  19. #if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
  20. # if !defined(__GNUC__) || (__GNUC__ >= 4)
  21. # define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS 1
  22. # endif // !defined(__GNUC__) || (__GNUC__ >= 4)
  23. #endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
  24. // With C++0x we can use a combination of enhanced SFINAE and static_assert to
  25. // generate better template error messages. As this technique is not yet widely
  26. // portable, we'll only enable it for tested compilers.
  27. #if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
  28. # if defined(__GNUC__)
  29. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  30. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  31. # define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1
  32. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  33. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  34. # endif // defined(__GNUC__)
  35. # if defined(BOOST_ASIO_MSVC)
  36. # if (_MSC_VER >= 1600)
  37. # define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1
  38. # endif // (_MSC_VER >= 1600)
  39. # endif // defined(BOOST_ASIO_MSVC)
  40. # if defined(__clang__)
  41. # if __has_feature(__cxx_static_assert__)
  42. # define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1
  43. # endif // __has_feature(cxx_static_assert)
  44. # endif // defined(__clang__)
  45. #endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
  46. #if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
  47. # include <boost/asio/async_result.hpp>
  48. #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
  49. namespace boost {
  50. namespace asio {
  51. namespace detail {
  52. #if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
  53. # if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
  54. template <typename Handler>
  55. auto zero_arg_copyable_handler_test(Handler h, void*)
  56. -> decltype(
  57. sizeof(Handler(static_cast<const Handler&>(h))),
  58. ((h)()),
  59. char(0));
  60. template <typename Handler>
  61. char (&zero_arg_copyable_handler_test(Handler, ...))[2];
  62. template <typename Handler, typename Arg1>
  63. auto one_arg_handler_test(Handler h, Arg1* a1)
  64. -> decltype(
  65. sizeof(Handler(BOOST_ASIO_MOVE_CAST(Handler)(h))),
  66. ((h)(*a1)),
  67. char(0));
  68. template <typename Handler>
  69. char (&one_arg_handler_test(Handler h, ...))[2];
  70. template <typename Handler, typename Arg1, typename Arg2>
  71. auto two_arg_handler_test(Handler h, Arg1* a1, Arg2* a2)
  72. -> decltype(
  73. sizeof(Handler(BOOST_ASIO_MOVE_CAST(Handler)(h))),
  74. ((h)(*a1, *a2)),
  75. char(0));
  76. template <typename Handler>
  77. char (&two_arg_handler_test(Handler, ...))[2];
  78. template <typename Handler, typename Arg1, typename Arg2>
  79. auto two_arg_move_handler_test(Handler h, Arg1* a1, Arg2* a2)
  80. -> decltype(
  81. sizeof(Handler(BOOST_ASIO_MOVE_CAST(Handler)(h))),
  82. ((h)(*a1, BOOST_ASIO_MOVE_CAST(Arg2)(*a2))),
  83. char(0));
  84. template <typename Handler>
  85. char (&two_arg_move_handler_test(Handler, ...))[2];
  86. # define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg) \
  87. static_assert(expr, msg);
  88. # else // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
  89. # define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg)
  90. # endif // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
  91. template <typename T> T& lvref();
  92. template <typename T> T& lvref(T);
  93. template <typename T> const T& clvref();
  94. template <typename T> const T& clvref(T);
  95. #if defined(BOOST_ASIO_HAS_MOVE)
  96. template <typename T> T rvref();
  97. template <typename T> T rvref(T);
  98. #else // defined(BOOST_ASIO_HAS_MOVE)
  99. template <typename T> const T& rvref();
  100. template <typename T> const T& rvref(T);
  101. #endif // defined(BOOST_ASIO_HAS_MOVE)
  102. template <typename T> char argbyv(T);
  103. template <int>
  104. struct handler_type_requirements
  105. {
  106. };
  107. #define BOOST_ASIO_LEGACY_COMPLETION_HANDLER_CHECK( \
  108. handler_type, handler) \
  109. \
  110. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  111. void()) asio_true_handler_type; \
  112. \
  113. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  114. sizeof(boost::asio::detail::zero_arg_copyable_handler_test( \
  115. boost::asio::detail::clvref< \
  116. asio_true_handler_type>(), 0)) == 1, \
  117. "CompletionHandler type requirements not met") \
  118. \
  119. typedef boost::asio::detail::handler_type_requirements< \
  120. sizeof( \
  121. boost::asio::detail::argbyv( \
  122. boost::asio::detail::clvref< \
  123. asio_true_handler_type>())) + \
  124. sizeof( \
  125. boost::asio::detail::lvref< \
  126. asio_true_handler_type>()(), \
  127. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  128. #define BOOST_ASIO_READ_HANDLER_CHECK( \
  129. handler_type, handler) \
  130. \
  131. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  132. void(boost::system::error_code, std::size_t)) \
  133. asio_true_handler_type; \
  134. \
  135. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  136. sizeof(boost::asio::detail::two_arg_handler_test( \
  137. boost::asio::detail::rvref< \
  138. asio_true_handler_type>(), \
  139. static_cast<const boost::system::error_code*>(0), \
  140. static_cast<const std::size_t*>(0))) == 1, \
  141. "ReadHandler type requirements not met") \
  142. \
  143. typedef boost::asio::detail::handler_type_requirements< \
  144. sizeof( \
  145. boost::asio::detail::argbyv( \
  146. boost::asio::detail::rvref< \
  147. asio_true_handler_type>())) + \
  148. sizeof( \
  149. boost::asio::detail::lvref< \
  150. asio_true_handler_type>()( \
  151. boost::asio::detail::lvref<const boost::system::error_code>(), \
  152. boost::asio::detail::lvref<const std::size_t>()), \
  153. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  154. #define BOOST_ASIO_WRITE_HANDLER_CHECK( \
  155. handler_type, handler) \
  156. \
  157. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  158. void(boost::system::error_code, std::size_t)) \
  159. asio_true_handler_type; \
  160. \
  161. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  162. sizeof(boost::asio::detail::two_arg_handler_test( \
  163. boost::asio::detail::rvref< \
  164. asio_true_handler_type>(), \
  165. static_cast<const boost::system::error_code*>(0), \
  166. static_cast<const std::size_t*>(0))) == 1, \
  167. "WriteHandler type requirements not met") \
  168. \
  169. typedef boost::asio::detail::handler_type_requirements< \
  170. sizeof( \
  171. boost::asio::detail::argbyv( \
  172. boost::asio::detail::rvref< \
  173. asio_true_handler_type>())) + \
  174. sizeof( \
  175. boost::asio::detail::lvref< \
  176. asio_true_handler_type>()( \
  177. boost::asio::detail::lvref<const boost::system::error_code>(), \
  178. boost::asio::detail::lvref<const std::size_t>()), \
  179. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  180. #define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \
  181. handler_type, handler) \
  182. \
  183. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  184. void(boost::system::error_code)) \
  185. asio_true_handler_type; \
  186. \
  187. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  188. sizeof(boost::asio::detail::one_arg_handler_test( \
  189. boost::asio::detail::rvref< \
  190. asio_true_handler_type>(), \
  191. static_cast<const boost::system::error_code*>(0))) == 1, \
  192. "AcceptHandler type requirements not met") \
  193. \
  194. typedef boost::asio::detail::handler_type_requirements< \
  195. sizeof( \
  196. boost::asio::detail::argbyv( \
  197. boost::asio::detail::rvref< \
  198. asio_true_handler_type>())) + \
  199. sizeof( \
  200. boost::asio::detail::lvref< \
  201. asio_true_handler_type>()( \
  202. boost::asio::detail::lvref<const boost::system::error_code>()), \
  203. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  204. #define BOOST_ASIO_MOVE_ACCEPT_HANDLER_CHECK( \
  205. handler_type, handler, socket_type) \
  206. \
  207. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  208. void(boost::system::error_code, socket_type)) \
  209. asio_true_handler_type; \
  210. \
  211. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  212. sizeof(boost::asio::detail::two_arg_move_handler_test( \
  213. boost::asio::detail::rvref< \
  214. asio_true_handler_type>(), \
  215. static_cast<const boost::system::error_code*>(0), \
  216. static_cast<socket_type*>(0))) == 1, \
  217. "MoveAcceptHandler type requirements not met") \
  218. \
  219. typedef boost::asio::detail::handler_type_requirements< \
  220. sizeof( \
  221. boost::asio::detail::argbyv( \
  222. boost::asio::detail::rvref< \
  223. asio_true_handler_type>())) + \
  224. sizeof( \
  225. boost::asio::detail::lvref< \
  226. asio_true_handler_type>()( \
  227. boost::asio::detail::lvref<const boost::system::error_code>(), \
  228. boost::asio::detail::rvref<socket_type>()), \
  229. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  230. #define BOOST_ASIO_CONNECT_HANDLER_CHECK( \
  231. handler_type, handler) \
  232. \
  233. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  234. void(boost::system::error_code)) \
  235. asio_true_handler_type; \
  236. \
  237. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  238. sizeof(boost::asio::detail::one_arg_handler_test( \
  239. boost::asio::detail::rvref< \
  240. asio_true_handler_type>(), \
  241. static_cast<const boost::system::error_code*>(0))) == 1, \
  242. "ConnectHandler type requirements not met") \
  243. \
  244. typedef boost::asio::detail::handler_type_requirements< \
  245. sizeof( \
  246. boost::asio::detail::argbyv( \
  247. boost::asio::detail::rvref< \
  248. asio_true_handler_type>())) + \
  249. sizeof( \
  250. boost::asio::detail::lvref< \
  251. asio_true_handler_type>()( \
  252. boost::asio::detail::lvref<const boost::system::error_code>()), \
  253. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  254. #define BOOST_ASIO_RANGE_CONNECT_HANDLER_CHECK( \
  255. handler_type, handler, endpoint_type) \
  256. \
  257. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  258. void(boost::system::error_code, endpoint_type)) \
  259. asio_true_handler_type; \
  260. \
  261. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  262. sizeof(boost::asio::detail::two_arg_handler_test( \
  263. boost::asio::detail::rvref< \
  264. asio_true_handler_type>(), \
  265. static_cast<const boost::system::error_code*>(0), \
  266. static_cast<const endpoint_type*>(0))) == 1, \
  267. "RangeConnectHandler type requirements not met") \
  268. \
  269. typedef boost::asio::detail::handler_type_requirements< \
  270. sizeof( \
  271. boost::asio::detail::argbyv( \
  272. boost::asio::detail::rvref< \
  273. asio_true_handler_type>())) + \
  274. sizeof( \
  275. boost::asio::detail::lvref< \
  276. asio_true_handler_type>()( \
  277. boost::asio::detail::lvref<const boost::system::error_code>(), \
  278. boost::asio::detail::lvref<const endpoint_type>()), \
  279. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  280. #define BOOST_ASIO_ITERATOR_CONNECT_HANDLER_CHECK( \
  281. handler_type, handler, iter_type) \
  282. \
  283. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  284. void(boost::system::error_code, iter_type)) \
  285. asio_true_handler_type; \
  286. \
  287. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  288. sizeof(boost::asio::detail::two_arg_handler_test( \
  289. boost::asio::detail::rvref< \
  290. asio_true_handler_type>(), \
  291. static_cast<const boost::system::error_code*>(0), \
  292. static_cast<const iter_type*>(0))) == 1, \
  293. "IteratorConnectHandler type requirements not met") \
  294. \
  295. typedef boost::asio::detail::handler_type_requirements< \
  296. sizeof( \
  297. boost::asio::detail::argbyv( \
  298. boost::asio::detail::rvref< \
  299. asio_true_handler_type>())) + \
  300. sizeof( \
  301. boost::asio::detail::lvref< \
  302. asio_true_handler_type>()( \
  303. boost::asio::detail::lvref<const boost::system::error_code>(), \
  304. boost::asio::detail::lvref<const iter_type>()), \
  305. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  306. #define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \
  307. handler_type, handler, range_type) \
  308. \
  309. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  310. void(boost::system::error_code, range_type)) \
  311. asio_true_handler_type; \
  312. \
  313. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  314. sizeof(boost::asio::detail::two_arg_handler_test( \
  315. boost::asio::detail::rvref< \
  316. asio_true_handler_type>(), \
  317. static_cast<const boost::system::error_code*>(0), \
  318. static_cast<const range_type*>(0))) == 1, \
  319. "ResolveHandler type requirements not met") \
  320. \
  321. typedef boost::asio::detail::handler_type_requirements< \
  322. sizeof( \
  323. boost::asio::detail::argbyv( \
  324. boost::asio::detail::rvref< \
  325. asio_true_handler_type>())) + \
  326. sizeof( \
  327. boost::asio::detail::lvref< \
  328. asio_true_handler_type>()( \
  329. boost::asio::detail::lvref<const boost::system::error_code>(), \
  330. boost::asio::detail::lvref<const range_type>()), \
  331. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  332. #define BOOST_ASIO_WAIT_HANDLER_CHECK( \
  333. handler_type, handler) \
  334. \
  335. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  336. void(boost::system::error_code)) \
  337. asio_true_handler_type; \
  338. \
  339. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  340. sizeof(boost::asio::detail::one_arg_handler_test( \
  341. boost::asio::detail::rvref< \
  342. asio_true_handler_type>(), \
  343. static_cast<const boost::system::error_code*>(0))) == 1, \
  344. "WaitHandler type requirements not met") \
  345. \
  346. typedef boost::asio::detail::handler_type_requirements< \
  347. sizeof( \
  348. boost::asio::detail::argbyv( \
  349. boost::asio::detail::rvref< \
  350. asio_true_handler_type>())) + \
  351. sizeof( \
  352. boost::asio::detail::lvref< \
  353. asio_true_handler_type>()( \
  354. boost::asio::detail::lvref<const boost::system::error_code>()), \
  355. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  356. #define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \
  357. handler_type, handler) \
  358. \
  359. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  360. void(boost::system::error_code, int)) \
  361. asio_true_handler_type; \
  362. \
  363. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  364. sizeof(boost::asio::detail::two_arg_handler_test( \
  365. boost::asio::detail::rvref< \
  366. asio_true_handler_type>(), \
  367. static_cast<const boost::system::error_code*>(0), \
  368. static_cast<const int*>(0))) == 1, \
  369. "SignalHandler type requirements not met") \
  370. \
  371. typedef boost::asio::detail::handler_type_requirements< \
  372. sizeof( \
  373. boost::asio::detail::argbyv( \
  374. boost::asio::detail::rvref< \
  375. asio_true_handler_type>())) + \
  376. sizeof( \
  377. boost::asio::detail::lvref< \
  378. asio_true_handler_type>()( \
  379. boost::asio::detail::lvref<const boost::system::error_code>(), \
  380. boost::asio::detail::lvref<const int>()), \
  381. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  382. #define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \
  383. handler_type, handler) \
  384. \
  385. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  386. void(boost::system::error_code)) \
  387. asio_true_handler_type; \
  388. \
  389. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  390. sizeof(boost::asio::detail::one_arg_handler_test( \
  391. boost::asio::detail::rvref< \
  392. asio_true_handler_type>(), \
  393. static_cast<const boost::system::error_code*>(0))) == 1, \
  394. "HandshakeHandler type requirements not met") \
  395. \
  396. typedef boost::asio::detail::handler_type_requirements< \
  397. sizeof( \
  398. boost::asio::detail::argbyv( \
  399. boost::asio::detail::rvref< \
  400. asio_true_handler_type>())) + \
  401. sizeof( \
  402. boost::asio::detail::lvref< \
  403. asio_true_handler_type>()( \
  404. boost::asio::detail::lvref<const boost::system::error_code>()), \
  405. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  406. #define BOOST_ASIO_BUFFERED_HANDSHAKE_HANDLER_CHECK( \
  407. handler_type, handler) \
  408. \
  409. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  410. void(boost::system::error_code, std::size_t)) \
  411. asio_true_handler_type; \
  412. \
  413. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  414. sizeof(boost::asio::detail::two_arg_handler_test( \
  415. boost::asio::detail::rvref< \
  416. asio_true_handler_type>(), \
  417. static_cast<const boost::system::error_code*>(0), \
  418. static_cast<const std::size_t*>(0))) == 1, \
  419. "BufferedHandshakeHandler type requirements not met") \
  420. \
  421. typedef boost::asio::detail::handler_type_requirements< \
  422. sizeof( \
  423. boost::asio::detail::argbyv( \
  424. boost::asio::detail::rvref< \
  425. asio_true_handler_type>())) + \
  426. sizeof( \
  427. boost::asio::detail::lvref< \
  428. asio_true_handler_type>()( \
  429. boost::asio::detail::lvref<const boost::system::error_code>(), \
  430. boost::asio::detail::lvref<const std::size_t>()), \
  431. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  432. #define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \
  433. handler_type, handler) \
  434. \
  435. typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
  436. void(boost::system::error_code)) \
  437. asio_true_handler_type; \
  438. \
  439. BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
  440. sizeof(boost::asio::detail::one_arg_handler_test( \
  441. boost::asio::detail::rvref< \
  442. asio_true_handler_type>(), \
  443. static_cast<const boost::system::error_code*>(0))) == 1, \
  444. "ShutdownHandler type requirements not met") \
  445. \
  446. typedef boost::asio::detail::handler_type_requirements< \
  447. sizeof( \
  448. boost::asio::detail::argbyv( \
  449. boost::asio::detail::rvref< \
  450. asio_true_handler_type>())) + \
  451. sizeof( \
  452. boost::asio::detail::lvref< \
  453. asio_true_handler_type>()( \
  454. boost::asio::detail::lvref<const boost::system::error_code>()), \
  455. char(0))> BOOST_ASIO_UNUSED_TYPEDEF
  456. #else // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
  457. #define BOOST_ASIO_LEGACY_COMPLETION_HANDLER_CHECK( \
  458. handler_type, handler) \
  459. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  460. #define BOOST_ASIO_READ_HANDLER_CHECK( \
  461. handler_type, handler) \
  462. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  463. #define BOOST_ASIO_WRITE_HANDLER_CHECK( \
  464. handler_type, handler) \
  465. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  466. #define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \
  467. handler_type, handler) \
  468. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  469. #define BOOST_ASIO_MOVE_ACCEPT_HANDLER_CHECK( \
  470. handler_type, handler, socket_type) \
  471. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  472. #define BOOST_ASIO_CONNECT_HANDLER_CHECK( \
  473. handler_type, handler) \
  474. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  475. #define BOOST_ASIO_RANGE_CONNECT_HANDLER_CHECK( \
  476. handler_type, handler, iter_type) \
  477. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  478. #define BOOST_ASIO_ITERATOR_CONNECT_HANDLER_CHECK( \
  479. handler_type, handler, iter_type) \
  480. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  481. #define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \
  482. handler_type, handler, iter_type) \
  483. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  484. #define BOOST_ASIO_WAIT_HANDLER_CHECK( \
  485. handler_type, handler) \
  486. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  487. #define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \
  488. handler_type, handler) \
  489. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  490. #define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \
  491. handler_type, handler) \
  492. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  493. #define BOOST_ASIO_BUFFERED_HANDSHAKE_HANDLER_CHECK( \
  494. handler_type, handler) \
  495. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  496. #define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \
  497. handler_type, handler) \
  498. typedef int BOOST_ASIO_UNUSED_TYPEDEF
  499. #endif // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
  500. } // namespace detail
  501. } // namespace asio
  502. } // namespace boost
  503. #endif // BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP