11 #ifndef ASIO_PREFER_HPP 12 #define ASIO_PREFER_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 #include "asio/detail/config.hpp" 19 #include "asio/detail/type_traits.hpp" 20 #include "asio/is_applicable_property.hpp" 21 #include "asio/traits/prefer_free.hpp" 22 #include "asio/traits/prefer_member.hpp" 23 #include "asio/traits/require_free.hpp" 24 #include "asio/traits/require_member.hpp" 25 #include "asio/traits/static_require.hpp" 27 #include "asio/detail/push_options.hpp" 29 #if defined(GENERATING_DOCUMENTATION) 76 inline constexpr unspecified prefer = unspecified;
84 template <
typename T,
typename... Properties>
86 integral_constant<bool, automatically_determined>
96 template <
typename T,
typename... Properties>
97 struct is_nothrow_prefer :
98 integral_constant<bool, automatically_determined>
108 template <
typename T,
typename... Properties>
112 typedef automatically_determined type;
117 #else // defined(GENERATING_DOCUMENTATION) 146 template <
typename T,
typename Properties,
typename =
void>
149 ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
150 ASIO_STATIC_CONSTEXPR(
bool, is_noexcept =
false);
151 typedef void result_type;
154 template <
typename T,
typename Property>
159 typename decay<T>::type,
160 typename decay<Property>::type
163 decay<Property>::type::is_preferable
169 ASIO_STATIC_CONSTEXPR(overload_type, overload = identity);
170 ASIO_STATIC_CONSTEXPR(
bool, is_noexcept =
true);
172 #if defined(ASIO_HAS_MOVE) 173 typedef ASIO_MOVE_ARG(T) result_type;
174 #else // defined(ASIO_HAS_MOVE) 175 typedef ASIO_MOVE_ARG(
typename decay<T>::type) result_type;
176 #endif // defined(ASIO_HAS_MOVE) 179 template <
typename T,
typename Property>
184 typename decay<T>::type,
185 typename decay<Property>::type
188 decay<Property>::type::is_preferable
197 ASIO_STATIC_CONSTEXPR(overload_type, overload = call_require_member);
200 template <
typename T,
typename Property>
205 typename decay<T>::type,
206 typename decay<Property>::type
209 decay<Property>::type::is_preferable
220 ASIO_STATIC_CONSTEXPR(overload_type, overload = call_require_free);
223 template <
typename T,
typename Property>
228 typename decay<T>::type,
229 typename decay<Property>::type
232 decay<Property>::type::is_preferable
245 ASIO_STATIC_CONSTEXPR(overload_type, overload = call_prefer_member);
248 template <
typename T,
typename Property>
253 typename decay<T>::type,
254 typename decay<Property>::type
257 decay<Property>::type::is_preferable
272 ASIO_STATIC_CONSTEXPR(overload_type, overload = call_prefer_free);
275 template <
typename T,
typename Property>
280 typename decay<T>::type,
281 typename decay<Property>::type
284 decay<Property>::type::is_preferable
298 ASIO_STATIC_CONSTEXPR(overload_type, overload = identity);
299 ASIO_STATIC_CONSTEXPR(
bool, is_noexcept =
true);
301 #if defined(ASIO_HAS_MOVE) 302 typedef ASIO_MOVE_ARG(T) result_type;
303 #else // defined(ASIO_HAS_MOVE) 304 typedef ASIO_MOVE_ARG(
typename decay<T>::type) result_type;
305 #endif // defined(ASIO_HAS_MOVE) 308 template <
typename T,
typename P0,
typename P1>
314 typename call_traits<T, void(P0)>::result_type,
316 >::overload != ill_formed
319 ASIO_STATIC_CONSTEXPR(overload_type, overload = two_props);
321 ASIO_STATIC_CONSTEXPR(
bool, is_noexcept =
331 typedef typename decay<
333 typename call_traits<T, void(P0)>::result_type,
339 template <
typename T,
typename P0,
typename P1,
typename ASIO_ELLIPSIS PN>
345 typename call_traits<T, void(P0)>::result_type,
346 void(P1, PN ASIO_ELLIPSIS)
347 >::overload != ill_formed
350 ASIO_STATIC_CONSTEXPR(overload_type, overload = n_props);
352 ASIO_STATIC_CONSTEXPR(
bool, is_noexcept =
358 void(P1, PN ASIO_ELLIPSIS)
362 typedef typename decay<
364 typename call_traits<T, void(P0)>::result_type,
365 void(P1, PN ASIO_ELLIPSIS)
372 template <
typename T,
typename Property>
373 ASIO_NODISCARD ASIO_CONSTEXPR
typename enable_if<
375 typename call_traits<T, void(Property)>::result_type
379 ASIO_MOVE_ARG(Property))
const 383 return ASIO_MOVE_CAST(T)(t);
386 template <
typename T,
typename Property>
387 ASIO_NODISCARD ASIO_CONSTEXPR
typename enable_if<
388 call_traits<T, void(Property)>::overload == call_require_member,
389 typename call_traits<T, void(Property)>::result_type
393 ASIO_MOVE_ARG(Property) p)
const 397 return ASIO_MOVE_CAST(T)(t).require(
398 ASIO_MOVE_CAST(Property)(p));
401 template <
typename T,
typename Property>
402 ASIO_NODISCARD ASIO_CONSTEXPR
typename enable_if<
403 call_traits<T, void(Property)>::overload == call_require_free,
404 typename call_traits<T, void(Property)>::result_type
408 ASIO_MOVE_ARG(Property) p)
const 413 ASIO_MOVE_CAST(T)(t),
414 ASIO_MOVE_CAST(Property)(p));
417 template <
typename T,
typename Property>
418 ASIO_NODISCARD ASIO_CONSTEXPR
typename enable_if<
419 call_traits<T, void(Property)>::overload == call_prefer_member,
420 typename call_traits<T, void(Property)>::result_type
424 ASIO_MOVE_ARG(Property) p)
const 428 return ASIO_MOVE_CAST(T)(t).prefer(
429 ASIO_MOVE_CAST(Property)(p));
432 template <
typename T,
typename Property>
433 ASIO_NODISCARD ASIO_CONSTEXPR
typename enable_if<
434 call_traits<T, void(Property)>::overload == call_prefer_free,
435 typename call_traits<T, void(Property)>::result_type
439 ASIO_MOVE_ARG(Property) p)
const 444 ASIO_MOVE_CAST(T)(t),
445 ASIO_MOVE_CAST(Property)(p));
448 template <
typename T,
typename P0,
typename P1>
449 ASIO_NODISCARD ASIO_CONSTEXPR
typename enable_if<
451 typename call_traits<T, void(P0, P1)>::result_type
455 ASIO_MOVE_ARG(P0) p0,
456 ASIO_MOVE_ARG(P1) p1)
const 462 ASIO_MOVE_CAST(T)(t),
463 ASIO_MOVE_CAST(P0)(p0)),
464 ASIO_MOVE_CAST(P1)(p1));
467 template <
typename T,
typename P0,
typename P1,
468 typename ASIO_ELLIPSIS PN>
469 ASIO_NODISCARD ASIO_CONSTEXPR
typename enable_if<
471 typename call_traits<T, void(P0, P1, PN ASIO_ELLIPSIS)>::result_type
475 ASIO_MOVE_ARG(P0) p0,
476 ASIO_MOVE_ARG(P1) p1,
477 ASIO_MOVE_ARG(PN) ASIO_ELLIPSIS pn)
const 479 call_traits<T,
void(P0, P1, PN ASIO_ELLIPSIS)>::is_noexcept))
483 ASIO_MOVE_CAST(T)(t),
484 ASIO_MOVE_CAST(P0)(p0)),
485 ASIO_MOVE_CAST(P1)(p1),
486 ASIO_MOVE_CAST(PN)(pn) ASIO_ELLIPSIS);
490 template <
typename T = impl>
493 static const T instance;
496 template <
typename T>
508 #if defined(ASIO_HAS_VARIADIC_TEMPLATES) 510 template <
typename T,
typename... Properties>
512 integral_constant<bool,
513 asio_prefer_fn::call_traits<T, void(Properties...)>::overload
514 != asio_prefer_fn::ill_formed>
518 #else // defined(ASIO_HAS_VARIADIC_TEMPLATES) 520 template <
typename T,
typename P0 = void,
521 typename P1 = void,
typename P2 =
void>
523 integral_constant<bool,
524 asio_prefer_fn::call_traits<T, void(P0, P1, P2)>::overload
525 != asio_prefer_fn::ill_formed>
529 template <
typename T,
typename P0,
typename P1>
531 integral_constant<bool,
532 asio_prefer_fn::call_traits<T, void(P0, P1)>::overload
533 != asio_prefer_fn::ill_formed>
537 template <
typename T,
typename P0>
539 integral_constant<bool,
540 asio_prefer_fn::call_traits<T, void(P0)>::overload
541 != asio_prefer_fn::ill_formed>
545 template <
typename T>
551 #endif // defined(ASIO_HAS_VARIADIC_TEMPLATES) 553 #if defined(ASIO_HAS_VARIABLE_TEMPLATES) 555 template <
typename T,
typename ASIO_ELLIPSIS Properties>
556 constexpr
bool can_prefer_v
559 #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES) 561 #if defined(ASIO_HAS_VARIADIC_TEMPLATES) 563 template <
typename T,
typename... Properties>
565 integral_constant<bool,
566 asio_prefer_fn::call_traits<T, void(Properties...)>::is_noexcept>
570 #else // defined(ASIO_HAS_VARIADIC_TEMPLATES) 572 template <
typename T,
typename P0 = void,
573 typename P1 = void,
typename P2 =
void>
575 integral_constant<bool,
576 asio_prefer_fn::call_traits<T, void(P0, P1, P2)>::is_noexcept>
580 template <
typename T,
typename P0,
typename P1>
582 integral_constant<bool,
583 asio_prefer_fn::call_traits<T, void(P0, P1)>::is_noexcept>
587 template <
typename T,
typename P0>
589 integral_constant<bool,
590 asio_prefer_fn::call_traits<T, void(P0)>::is_noexcept>
594 template <
typename T>
600 #endif // defined(ASIO_HAS_VARIADIC_TEMPLATES) 602 #if defined(ASIO_HAS_VARIABLE_TEMPLATES) 604 template <
typename T,
typename ASIO_ELLIPSIS Properties>
605 constexpr
bool is_nothrow_prefer_v
608 #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES) 610 #if defined(ASIO_HAS_VARIADIC_TEMPLATES) 612 template <
typename T,
typename... Properties>
616 T, void(Properties...)>::result_type type;
619 #else // defined(ASIO_HAS_VARIADIC_TEMPLATES) 621 template <
typename T,
typename P0 = void,
622 typename P1 = void,
typename P2 =
void>
626 T, void(P0, P1, P2)>::result_type type;
629 template <
typename T,
typename P0,
typename P1>
633 T, void(P0, P1)>::result_type type;
636 template <
typename T,
typename P0>
640 T, void(P0)>::result_type type;
643 template <
typename T>
648 #endif // defined(ASIO_HAS_VARIADIC_TEMPLATES) 652 #endif // defined(GENERATING_DOCUMENTATION) 654 #include "asio/detail/pop_options.hpp" 656 #endif // ASIO_PREFER_HPP Definition: prefer.hpp:370
Definition: static_require.hpp:37
Definition: prefer.hpp:491
Definition: prefer.hpp:574
Definition: prefer_member.hpp:38
Definition: type_traits.hpp:97
Definition: require_member.hpp:38
Definition: prefer.hpp:119
Definition: prefer.hpp:623
Definition: prefer.hpp:147
Definition: prefer.hpp:522
Definition: is_applicable_property.hpp:46
Definition: require_free.hpp:38
Definition: prefer_free.hpp:38
Definition: any_io_executor.hpp:28