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