Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-17 08:38:13

0001 //
0002 // execution/inline_exception_handling.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2025 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_EXECUTION_INLINE_EXCEPTION_HANDLING_HPP
0012 #define BOOST_ASIO_EXECUTION_INLINE_EXCEPTION_HANDLING_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/detail/type_traits.hpp>
0020 #include <boost/asio/execution/executor.hpp>
0021 #include <boost/asio/is_applicable_property.hpp>
0022 #include <boost/asio/prefer.hpp>
0023 #include <boost/asio/query.hpp>
0024 #include <boost/asio/require.hpp>
0025 #include <boost/asio/traits/execute_member.hpp>
0026 #include <boost/asio/traits/query_free.hpp>
0027 #include <boost/asio/traits/query_member.hpp>
0028 #include <boost/asio/traits/query_static_constexpr_member.hpp>
0029 #include <boost/asio/traits/static_query.hpp>
0030 #include <boost/asio/traits/static_require.hpp>
0031 
0032 #include <boost/asio/detail/push_options.hpp>
0033 
0034 namespace boost {
0035 namespace asio {
0036 
0037 #if defined(GENERATING_DOCUMENTATION)
0038 
0039 namespace execution {
0040 
0041 /// A property to describe what guarantees an executor makes about the treatment
0042 /// of exceptions that are thrown by a submitted function, when that function
0043 /// is executed inline within @c execute.
0044 struct inline_exception_handling_t
0045 {
0046   /// The inline_exception_handling property applies to executors.
0047   template <typename T>
0048   static constexpr bool is_applicable_property_v = is_executor_v<T>;
0049 
0050   /// The top-level inline_exception_handling property cannot be required.
0051   static constexpr bool is_requirable = false;
0052 
0053   /// The top-level inline_exception_handling property cannot be preferred.
0054   static constexpr bool is_preferable = false;
0055 
0056   /// The type returned by queries against an @c any_executor.
0057   typedef inline_exception_handling_t polymorphic_query_result_type;
0058 
0059   /// A sub-property that indicates that invocation of an executor's execution
0060   /// function will propagate any exceptions that are thrown by the submitted
0061   /// function object, if that function object is executed inline.
0062   struct propagate_t
0063   {
0064     /// The inline_exception_handling_t::propagate_t property applies to
0065     /// executors.
0066     template <typename T>
0067     static constexpr bool is_applicable_property_v = is_executor_v<T>;
0068 
0069     /// The inline_exception_handling_t::propagate_t property can be required.
0070     static constexpr bool is_requirable = true;
0071 
0072     /// The inline_exception_handling_t::propagate_t property can be preferred.
0073     static constexpr bool is_preferable = true;
0074 
0075     /// The type returned by queries against an @c any_executor.
0076     typedef inline_exception_handling_t polymorphic_query_result_type;
0077 
0078     /// Default constructor.
0079     constexpr propagate_t();
0080 
0081     /// Get the value associated with a property object.
0082     /**
0083      * @returns propagate_t();
0084      */
0085     static constexpr inline_exception_handling_t value();
0086   };
0087 
0088   /// A sub-property that indicates that invocation of an executor's execution
0089   /// function will capture any exceptions that are thrown by the submitted
0090   /// function object, if that function object is executed inline. Captured
0091   /// exceptions are forwarded to an executor-defined handling mechanism.
0092   struct capture_t
0093   {
0094     /// The inline_exception_handling_t::capture_t property applies to
0095     /// executors.
0096     template <typename T>
0097     static constexpr bool is_applicable_property_v = is_executor_v<T>;
0098 
0099     /// The inline_exception_handling_t::capture_t property can be required.
0100     static constexpr bool is_requirable = true;
0101 
0102     /// The inline_exception_handling_t::capture_t property can be preferred.
0103     static constexpr bool is_preferable = false;
0104 
0105     /// The type returned by queries against an @c any_executor.
0106     typedef inline_exception_handling_t polymorphic_query_result_type;
0107 
0108     /// Default constructor.
0109     constexpr capture_t();
0110 
0111     /// Get the value associated with a property object.
0112     /**
0113      * @returns capture_t();
0114      */
0115     static constexpr inline_exception_handling_t value();
0116   };
0117 
0118   /// A sub-property that indicates that invocation of an executor's execution
0119   /// function will terminate the program if any exceptions that are thrown by
0120   /// the submitted function object, if that function object is executed inline.
0121   struct terminate_t
0122   {
0123     /// The inline_exception_handling_t::terminate_t property applies to
0124     /// executors.
0125     template <typename T>
0126     static constexpr bool is_applicable_property_v = is_executor_v<T>;
0127 
0128     /// The inline_exception_handling_t::terminate_t property can be required.
0129     static constexpr bool is_requirable = true;
0130 
0131     /// The inline_exception_handling_t::terminate_t property can be preferred.
0132     static constexpr bool is_preferable = true;
0133 
0134     /// The type returned by queries against an @c any_executor.
0135     typedef inline_exception_handling_t polymorphic_query_result_type;
0136 
0137     /// Default constructor.
0138     constexpr terminate_t();
0139 
0140     /// Get the value associated with a property object.
0141     /**
0142      * @returns terminate_t();
0143      */
0144     static constexpr inline_exception_handling_t value();
0145   };
0146 
0147   /// A special value used for accessing the
0148   /// inline_exception_handling_t::propagate_t property.
0149   static constexpr propagate_t propagate;
0150 
0151   /// A special value used for accessing the
0152   /// inline_exception_handling_t::capture_t property.
0153   static constexpr capture_t capture;
0154 
0155   /// A special value used for accessing the
0156   /// inline_exception_handling_t::terminate_t property.
0157   static constexpr terminate_t terminate;
0158 
0159   /// Default constructor.
0160   constexpr inline_exception_handling_t();
0161 
0162   /// Construct from a sub-property value.
0163   constexpr inline_exception_handling_t(propagate_t);
0164 
0165   /// Construct from a sub-property value.
0166   constexpr inline_exception_handling_t(capture_t);
0167 
0168   /// Construct from a sub-property value.
0169   constexpr inline_exception_handling_t(terminate_t);
0170 
0171   /// Compare property values for equality.
0172   friend constexpr bool operator==(const inline_exception_handling_t& a,
0173     const inline_exception_handling_t& b) noexcept;
0174 
0175   /// Compare property values for inequality.
0176   friend constexpr bool operator!=(const inline_exception_handling_t& a,
0177     const inline_exception_handling_t& b) noexcept;
0178 };
0179 
0180 /// A special value used for accessing the inline_exception_handling property.
0181 constexpr inline_exception_handling_t inline_exception_handling;
0182 
0183 } // namespace execution
0184 
0185 #else // defined(GENERATING_DOCUMENTATION)
0186 
0187 namespace execution {
0188 namespace detail {
0189 namespace inline_exception_handling {
0190 
0191 template <int I> struct propagate_t;
0192 template <int I> struct capture_t;
0193 template <int I> struct terminate_t;
0194 
0195 } // namespace inline_exception_handling
0196 
0197 template <int I = 0>
0198 struct inline_exception_handling_t
0199 {
0200 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0201   template <typename T>
0202   static constexpr bool is_applicable_property_v = is_executor<T>::value;
0203 #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0204 
0205   static constexpr bool is_requirable = false;
0206   static constexpr bool is_preferable = false;
0207   typedef inline_exception_handling_t polymorphic_query_result_type;
0208 
0209   typedef detail::inline_exception_handling::propagate_t<I> propagate_t;
0210   typedef detail::inline_exception_handling::capture_t<I> capture_t;
0211   typedef detail::inline_exception_handling::terminate_t<I> terminate_t;
0212 
0213   constexpr inline_exception_handling_t()
0214     : value_(-1)
0215   {
0216   }
0217 
0218   constexpr inline_exception_handling_t(propagate_t)
0219     : value_(0)
0220   {
0221   }
0222 
0223   constexpr inline_exception_handling_t(capture_t)
0224     : value_(1)
0225   {
0226   }
0227 
0228   constexpr inline_exception_handling_t(terminate_t)
0229     : value_(2)
0230   {
0231   }
0232 
0233   template <typename T>
0234   struct proxy
0235   {
0236 #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
0237     struct type
0238     {
0239       template <typename P>
0240       auto query(P&& p) const
0241         noexcept(
0242           noexcept(
0243             declval<conditional_t<true, T, P>>().query(static_cast<P&&>(p))
0244           )
0245         )
0246         -> decltype(
0247           declval<conditional_t<true, T, P>>().query(static_cast<P&&>(p))
0248         );
0249     };
0250 #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
0251     typedef T type;
0252 #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
0253   };
0254 
0255   template <typename T>
0256   struct static_proxy
0257   {
0258 #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
0259     struct type
0260     {
0261       template <typename P>
0262       static constexpr auto query(P&& p)
0263         noexcept(
0264           noexcept(
0265             conditional_t<true, T, P>::query(static_cast<P&&>(p))
0266           )
0267         )
0268         -> decltype(
0269           conditional_t<true, T, P>::query(static_cast<P&&>(p))
0270         )
0271       {
0272         return T::query(static_cast<P&&>(p));
0273       }
0274     };
0275 #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
0276     typedef T type;
0277 #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
0278   };
0279 
0280   template <typename T>
0281   struct query_member :
0282     traits::query_member<typename proxy<T>::type,
0283       inline_exception_handling_t> {};
0284 
0285   template <typename T>
0286   struct query_static_constexpr_member :
0287     traits::query_static_constexpr_member<
0288       typename static_proxy<T>::type, inline_exception_handling_t> {};
0289 
0290 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
0291   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0292   template <typename T>
0293   static constexpr
0294   typename query_static_constexpr_member<T>::result_type
0295   static_query()
0296     noexcept(query_static_constexpr_member<T>::is_noexcept)
0297   {
0298     return query_static_constexpr_member<T>::value();
0299   }
0300 
0301   template <typename T>
0302   static constexpr
0303   typename traits::static_query<T, propagate_t>::result_type
0304   static_query(
0305       enable_if_t<
0306         !query_static_constexpr_member<T>::is_valid
0307       >* = 0,
0308       enable_if_t<
0309         !query_member<T>::is_valid
0310       >* = 0,
0311       enable_if_t<
0312         traits::static_query<T, propagate_t>::is_valid
0313       >* = 0) noexcept
0314   {
0315     return traits::static_query<T, propagate_t>::value();
0316   }
0317 
0318   template <typename T>
0319   static constexpr
0320   typename traits::static_query<T, capture_t>::result_type
0321   static_query(
0322       enable_if_t<
0323         !query_static_constexpr_member<T>::is_valid
0324       >* = 0,
0325       enable_if_t<
0326         !query_member<T>::is_valid
0327       >* = 0,
0328       enable_if_t<
0329         !traits::static_query<T, propagate_t>::is_valid
0330       >* = 0,
0331       enable_if_t<
0332         traits::static_query<T, capture_t>::is_valid
0333       >* = 0) noexcept
0334   {
0335     return traits::static_query<T, capture_t>::value();
0336   }
0337 
0338   template <typename T>
0339   static constexpr
0340   typename traits::static_query<T, terminate_t>::result_type
0341   static_query(
0342       enable_if_t<
0343         !query_static_constexpr_member<T>::is_valid
0344       >* = 0,
0345       enable_if_t<
0346         !query_member<T>::is_valid
0347       >* = 0,
0348       enable_if_t<
0349         !traits::static_query<T, propagate_t>::is_valid
0350       >* = 0,
0351       enable_if_t<
0352         !traits::static_query<T, capture_t>::is_valid
0353       >* = 0,
0354       enable_if_t<
0355         traits::static_query<T, terminate_t>::is_valid
0356       >* = 0) noexcept
0357   {
0358     return traits::static_query<T, terminate_t>::value();
0359   }
0360 
0361   template <typename E,
0362       typename T = decltype(inline_exception_handling_t::static_query<E>())>
0363   static constexpr const T static_query_v
0364     = inline_exception_handling_t::static_query<E>();
0365 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
0366        //   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0367 
0368   friend constexpr bool operator==(const inline_exception_handling_t& a,
0369       const inline_exception_handling_t& b)
0370   {
0371     return a.value_ == b.value_;
0372   }
0373 
0374   friend constexpr bool operator!=(const inline_exception_handling_t& a,
0375       const inline_exception_handling_t& b)
0376   {
0377     return a.value_ != b.value_;
0378   }
0379 
0380   struct convertible_from_inline_exception_handling_t
0381   {
0382     constexpr convertible_from_inline_exception_handling_t(
0383         inline_exception_handling_t) {}
0384   };
0385 
0386   template <typename Executor>
0387   friend constexpr inline_exception_handling_t query(
0388       const Executor& ex, convertible_from_inline_exception_handling_t,
0389       enable_if_t<
0390         can_query<const Executor&, propagate_t>::value
0391       >* = 0)
0392 #if !defined(__clang__) // Clang crashes if noexcept is used here.
0393 #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
0394     noexcept(is_nothrow_query<const Executor&,
0395         inline_exception_handling_t<>::propagate_t>::value)
0396 #else // defined(BOOST_ASIO_MSVC)
0397     noexcept(is_nothrow_query<const Executor&, propagate_t>::value)
0398 #endif // defined(BOOST_ASIO_MSVC)
0399 #endif // !defined(__clang__)
0400   {
0401     return boost::asio::query(ex, propagate_t());
0402   }
0403 
0404   template <typename Executor>
0405   friend constexpr inline_exception_handling_t query(
0406       const Executor& ex, convertible_from_inline_exception_handling_t,
0407       enable_if_t<
0408         !can_query<const Executor&, propagate_t>::value
0409       >* = 0,
0410       enable_if_t<
0411         can_query<const Executor&, capture_t>::value
0412       >* = 0)
0413 #if !defined(__clang__) // Clang crashes if noexcept is used here.
0414 #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
0415     noexcept(is_nothrow_query<const Executor&,
0416         inline_exception_handling_t<>::capture_t>::value)
0417 #else // defined(BOOST_ASIO_MSVC)
0418     noexcept(is_nothrow_query<const Executor&, capture_t>::value)
0419 #endif // defined(BOOST_ASIO_MSVC)
0420 #endif // !defined(__clang__)
0421   {
0422     return boost::asio::query(ex, capture_t());
0423   }
0424 
0425   template <typename Executor>
0426   friend constexpr inline_exception_handling_t query(
0427       const Executor& ex, convertible_from_inline_exception_handling_t,
0428       enable_if_t<
0429         !can_query<const Executor&, propagate_t>::value
0430       >* = 0,
0431       enable_if_t<
0432         !can_query<const Executor&, capture_t>::value
0433       >* = 0,
0434       enable_if_t<
0435         can_query<const Executor&, terminate_t>::value
0436       >* = 0)
0437 #if !defined(__clang__) // Clang crashes if noexcept is used here.
0438 #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
0439     noexcept(is_nothrow_query<const Executor&,
0440         inline_exception_handling_t<>::terminate_t>::value)
0441 #else // defined(BOOST_ASIO_MSVC)
0442     noexcept(is_nothrow_query<const Executor&, terminate_t>::value)
0443 #endif // defined(BOOST_ASIO_MSVC)
0444 #endif // !defined(__clang__)
0445   {
0446     return boost::asio::query(ex, terminate_t());
0447   }
0448 
0449   BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(propagate_t, propagate);
0450   BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(capture_t, capture);
0451   BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(terminate_t, terminate);
0452 
0453 private:
0454   int value_;
0455 };
0456 
0457 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
0458   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0459 template <int I> template <typename E, typename T>
0460 const T inline_exception_handling_t<I>::static_query_v;
0461 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
0462        //   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0463 
0464 template <int I>
0465 const typename inline_exception_handling_t<I>::propagate_t
0466 inline_exception_handling_t<I>::propagate;
0467 
0468 template <int I>
0469 const typename inline_exception_handling_t<I>::capture_t
0470 inline_exception_handling_t<I>::capture;
0471 
0472 template <int I>
0473 const typename inline_exception_handling_t<I>::terminate_t
0474 inline_exception_handling_t<I>::terminate;
0475 
0476 namespace inline_exception_handling {
0477 
0478 template <int I = 0>
0479 struct propagate_t
0480 {
0481 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0482   template <typename T>
0483   static constexpr bool is_applicable_property_v = is_executor<T>::value;
0484 #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0485 
0486   static constexpr bool is_requirable = true;
0487   static constexpr bool is_preferable = true;
0488   typedef inline_exception_handling_t<I> polymorphic_query_result_type;
0489 
0490   constexpr propagate_t()
0491   {
0492   }
0493 
0494   template <typename T>
0495   struct query_member :
0496     traits::query_member<
0497       typename inline_exception_handling_t<I>::template
0498         proxy<T>::type, propagate_t> {};
0499 
0500   template <typename T>
0501   struct query_static_constexpr_member :
0502     traits::query_static_constexpr_member<
0503       typename inline_exception_handling_t<I>::template
0504         static_proxy<T>::type, propagate_t> {};
0505 
0506 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
0507   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0508   template <typename T>
0509   static constexpr
0510   typename query_static_constexpr_member<T>::result_type
0511   static_query()
0512     noexcept(query_static_constexpr_member<T>::is_noexcept)
0513   {
0514     return query_static_constexpr_member<T>::value();
0515   }
0516 
0517   template <typename T>
0518   static constexpr propagate_t static_query(
0519       enable_if_t<
0520         !query_static_constexpr_member<T>::is_valid
0521       >* = 0,
0522       enable_if_t<
0523         !query_member<T>::is_valid
0524       >* = 0,
0525       enable_if_t<
0526         !traits::query_free<T, propagate_t>::is_valid
0527       >* = 0,
0528       enable_if_t<
0529         !can_query<T, capture_t<I>>::value
0530       >* = 0,
0531       enable_if_t<
0532         !can_query<T, terminate_t<I>>::value
0533       >* = 0) noexcept
0534   {
0535     return propagate_t();
0536   }
0537 
0538   template <typename E, typename T = decltype(propagate_t::static_query<E>())>
0539   static constexpr const T static_query_v
0540     = propagate_t::static_query<E>();
0541 #endif // defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0542        //   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0543 
0544   static constexpr inline_exception_handling_t<I> value()
0545   {
0546     return propagate_t();
0547   }
0548 
0549   friend constexpr bool operator==(
0550       const propagate_t&, const propagate_t&)
0551   {
0552     return true;
0553   }
0554 
0555   friend constexpr bool operator!=(
0556       const propagate_t&, const propagate_t&)
0557   {
0558     return false;
0559   }
0560 
0561   friend constexpr bool operator==(
0562       const propagate_t&, const capture_t<I>&)
0563   {
0564     return false;
0565   }
0566 
0567   friend constexpr bool operator!=(
0568       const propagate_t&, const capture_t<I>&)
0569   {
0570     return true;
0571   }
0572 
0573   friend constexpr bool operator==(
0574       const propagate_t&, const terminate_t<I>&)
0575   {
0576     return false;
0577   }
0578 
0579   friend constexpr bool operator!=(
0580       const propagate_t&, const terminate_t<I>&)
0581   {
0582     return true;
0583   }
0584 };
0585 
0586 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
0587   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0588 template <int I> template <typename E, typename T>
0589 const T propagate_t<I>::static_query_v;
0590 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
0591        //   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0592 
0593 template <int I = 0>
0594 struct capture_t
0595 {
0596 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0597   template <typename T>
0598   static constexpr bool is_applicable_property_v = is_executor<T>::value;
0599 #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0600 
0601   static constexpr bool is_requirable = true;
0602   static constexpr bool is_preferable = false;
0603   typedef inline_exception_handling_t<I> polymorphic_query_result_type;
0604 
0605   constexpr capture_t()
0606   {
0607   }
0608 
0609   template <typename T>
0610   struct query_member :
0611     traits::query_member<
0612       typename inline_exception_handling_t<I>::template
0613         proxy<T>::type, capture_t> {};
0614 
0615   template <typename T>
0616   struct query_static_constexpr_member :
0617     traits::query_static_constexpr_member<
0618       typename inline_exception_handling_t<I>::template
0619         static_proxy<T>::type, capture_t> {};
0620 
0621 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
0622   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0623   template <typename T>
0624   static constexpr typename query_static_constexpr_member<T>::result_type
0625   static_query()
0626     noexcept(query_static_constexpr_member<T>::is_noexcept)
0627   {
0628     return query_static_constexpr_member<T>::value();
0629   }
0630 
0631   template <typename E, typename T = decltype(capture_t::static_query<E>())>
0632   static constexpr const T static_query_v = capture_t::static_query<E>();
0633 #endif // defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0634        //   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0635 
0636   static constexpr inline_exception_handling_t<I> value()
0637   {
0638     return capture_t();
0639   }
0640 
0641   friend constexpr bool operator==(
0642       const capture_t&, const capture_t&)
0643   {
0644     return true;
0645   }
0646 
0647   friend constexpr bool operator!=(
0648       const capture_t&, const capture_t&)
0649   {
0650     return false;
0651   }
0652 
0653   friend constexpr bool operator==(
0654       const capture_t&, const propagate_t<I>&)
0655   {
0656     return false;
0657   }
0658 
0659   friend constexpr bool operator!=(
0660       const capture_t&, const propagate_t<I>&)
0661   {
0662     return true;
0663   }
0664 
0665   friend constexpr bool operator==(
0666       const capture_t&, const terminate_t<I>&)
0667   {
0668     return false;
0669   }
0670 
0671   friend constexpr bool operator!=(
0672       const capture_t&, const terminate_t<I>&)
0673   {
0674     return true;
0675   }
0676 };
0677 
0678 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
0679   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0680 template <int I> template <typename E, typename T>
0681 const T capture_t<I>::static_query_v;
0682 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
0683        //   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0684 
0685 template <int I>
0686 struct terminate_t
0687 {
0688 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0689   template <typename T>
0690   static constexpr bool is_applicable_property_v = is_executor<T>::value;
0691 #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0692 
0693   static constexpr bool is_requirable = true;
0694   static constexpr bool is_preferable = true;
0695   typedef inline_exception_handling_t<I> polymorphic_query_result_type;
0696 
0697   constexpr terminate_t()
0698   {
0699   }
0700 
0701   template <typename T>
0702   struct query_member :
0703     traits::query_member<
0704       typename inline_exception_handling_t<I>::template
0705         proxy<T>::type, terminate_t> {};
0706 
0707   template <typename T>
0708   struct query_static_constexpr_member :
0709     traits::query_static_constexpr_member<
0710       typename inline_exception_handling_t<I>::template
0711         static_proxy<T>::type, terminate_t> {};
0712 
0713 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
0714   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0715   template <typename T>
0716   static constexpr
0717   typename query_static_constexpr_member<T>::result_type
0718   static_query()
0719     noexcept(query_static_constexpr_member<T>::is_noexcept)
0720   {
0721     return query_static_constexpr_member<T>::value();
0722   }
0723 
0724   template <typename E, typename T = decltype(terminate_t::static_query<E>())>
0725   static constexpr const T static_query_v
0726     = terminate_t::static_query<E>();
0727 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
0728        //   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0729 
0730   static constexpr inline_exception_handling_t<I> value()
0731   {
0732     return terminate_t();
0733   }
0734 
0735   friend constexpr bool operator==(const terminate_t&, const terminate_t&)
0736   {
0737     return true;
0738   }
0739 
0740   friend constexpr bool operator!=(const terminate_t&, const terminate_t&)
0741   {
0742     return false;
0743   }
0744 
0745   friend constexpr bool operator==(const terminate_t&, const propagate_t<I>&)
0746   {
0747     return false;
0748   }
0749 
0750   friend constexpr bool operator!=(const terminate_t&, const propagate_t<I>&)
0751   {
0752     return true;
0753   }
0754 
0755   friend constexpr bool operator==(const terminate_t&, const capture_t<I>&)
0756   {
0757     return false;
0758   }
0759 
0760   friend constexpr bool operator!=(const terminate_t&, const capture_t<I>&)
0761   {
0762     return true;
0763   }
0764 };
0765 
0766 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
0767   && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0768 template <int I> template <typename E, typename T>
0769 const T terminate_t<I>::static_query_v;
0770 #endif // defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0771 
0772 } // namespace inline_exception_handling
0773 } // namespace detail
0774 
0775 typedef detail::inline_exception_handling_t<> inline_exception_handling_t;
0776 
0777 BOOST_ASIO_INLINE_VARIABLE constexpr
0778 inline_exception_handling_t inline_exception_handling;
0779 
0780 } // namespace execution
0781 
0782 #if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0783 
0784 template <typename T>
0785 struct is_applicable_property<T, execution::inline_exception_handling_t>
0786   : integral_constant<bool, execution::is_executor<T>::value>
0787 {
0788 };
0789 
0790 template <typename T>
0791 struct is_applicable_property<T,
0792     execution::inline_exception_handling_t::propagate_t>
0793   : integral_constant<bool, execution::is_executor<T>::value>
0794 {
0795 };
0796 
0797 template <typename T>
0798 struct is_applicable_property<T,
0799     execution::inline_exception_handling_t::capture_t>
0800   : integral_constant<bool, execution::is_executor<T>::value>
0801 {
0802 };
0803 
0804 template <typename T>
0805 struct is_applicable_property<T,
0806     execution::inline_exception_handling_t::terminate_t>
0807   : integral_constant<bool, execution::is_executor<T>::value>
0808 {
0809 };
0810 
0811 #endif // !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
0812 
0813 namespace traits {
0814 
0815 #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
0816 
0817 template <typename T>
0818 struct query_free_default<T, execution::inline_exception_handling_t,
0819   enable_if_t<
0820     can_query<T, execution::inline_exception_handling_t::propagate_t>::value
0821   >>
0822 {
0823   static constexpr bool is_valid = true;
0824   static constexpr bool is_noexcept = is_nothrow_query<T,
0825       execution::inline_exception_handling_t::propagate_t>::value;
0826 
0827   typedef execution::inline_exception_handling_t result_type;
0828 };
0829 
0830 template <typename T>
0831 struct query_free_default<T, execution::inline_exception_handling_t,
0832   enable_if_t<
0833     !can_query<T, execution::inline_exception_handling_t::propagate_t>::value
0834       && can_query<T, execution::inline_exception_handling_t::capture_t>::value
0835   >>
0836 {
0837   static constexpr bool is_valid = true;
0838   static constexpr bool is_noexcept = is_nothrow_query<T,
0839       execution::inline_exception_handling_t::capture_t>::value;
0840 
0841   typedef execution::inline_exception_handling_t result_type;
0842 };
0843 
0844 template <typename T>
0845 struct query_free_default<T, execution::inline_exception_handling_t,
0846   enable_if_t<
0847     !can_query<T,
0848         execution::inline_exception_handling_t::propagate_t>::value
0849       && !can_query<T,
0850         execution::inline_exception_handling_t::capture_t>::value
0851       && can_query<T,
0852         execution::inline_exception_handling_t::terminate_t>::value
0853   >>
0854 {
0855   static constexpr bool is_valid = true;
0856   static constexpr bool is_noexcept = is_nothrow_query<T,
0857       execution::inline_exception_handling_t::terminate_t>::value;
0858 
0859   typedef execution::inline_exception_handling_t result_type;
0860 };
0861 
0862 #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
0863 
0864 #if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
0865   || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
0866 
0867 template <typename T>
0868 struct static_query<T, execution::inline_exception_handling_t,
0869   enable_if_t<
0870     execution::detail::inline_exception_handling_t<0>::
0871       query_static_constexpr_member<T>::is_valid
0872   >>
0873 {
0874   static constexpr bool is_valid = true;
0875   static constexpr bool is_noexcept = true;
0876 
0877   typedef typename execution::detail::inline_exception_handling_t<0>::
0878     query_static_constexpr_member<T>::result_type result_type;
0879 
0880   static constexpr result_type value()
0881   {
0882     return execution::inline_exception_handling_t::
0883       query_static_constexpr_member<T>::value();
0884   }
0885 };
0886 
0887 template <typename T>
0888 struct static_query<T, execution::inline_exception_handling_t,
0889   enable_if_t<
0890     !execution::detail::inline_exception_handling_t<0>::
0891         query_static_constexpr_member<T>::is_valid
0892       && !execution::detail::inline_exception_handling_t<0>::
0893         query_member<T>::is_valid
0894       && traits::static_query<T,
0895         execution::inline_exception_handling_t::propagate_t>::is_valid
0896   >>
0897 {
0898   static constexpr bool is_valid = true;
0899   static constexpr bool is_noexcept = true;
0900 
0901   typedef typename traits::static_query<T,
0902     execution::inline_exception_handling_t::propagate_t>::result_type
0903       result_type;
0904 
0905   static constexpr result_type value()
0906   {
0907     return traits::static_query<T,
0908         execution::inline_exception_handling_t::propagate_t>::value();
0909   }
0910 };
0911 
0912 template <typename T>
0913 struct static_query<T, execution::inline_exception_handling_t,
0914   enable_if_t<
0915     !execution::detail::inline_exception_handling_t<0>::
0916         query_static_constexpr_member<T>::is_valid
0917       && !execution::detail::inline_exception_handling_t<0>::
0918         query_member<T>::is_valid
0919       && !traits::static_query<T,
0920         execution::inline_exception_handling_t::propagate_t>::is_valid
0921       && traits::static_query<T,
0922         execution::inline_exception_handling_t::capture_t>::is_valid
0923   >>
0924 {
0925   static constexpr bool is_valid = true;
0926   static constexpr bool is_noexcept = true;
0927 
0928   typedef typename traits::static_query<T,
0929     execution::inline_exception_handling_t::capture_t>::result_type result_type;
0930 
0931   static constexpr result_type value()
0932   {
0933     return traits::static_query<T,
0934         execution::inline_exception_handling_t::capture_t>::value();
0935   }
0936 };
0937 
0938 template <typename T>
0939 struct static_query<T, execution::inline_exception_handling_t,
0940   enable_if_t<
0941     !execution::detail::inline_exception_handling_t<0>::
0942         query_static_constexpr_member<T>::is_valid
0943       && !execution::detail::inline_exception_handling_t<0>::
0944         query_member<T>::is_valid
0945       && !traits::static_query<T,
0946         execution::inline_exception_handling_t::propagate_t>::is_valid
0947       && !traits::static_query<T,
0948         execution::inline_exception_handling_t::capture_t>::is_valid
0949       && traits::static_query<T,
0950         execution::inline_exception_handling_t::terminate_t>::is_valid
0951   >>
0952 {
0953   static constexpr bool is_valid = true;
0954   static constexpr bool is_noexcept = true;
0955 
0956   typedef typename traits::static_query<T,
0957     execution::inline_exception_handling_t::terminate_t>::result_type
0958       result_type;
0959 
0960   static constexpr result_type value()
0961   {
0962     return traits::static_query<T,
0963         execution::inline_exception_handling_t::terminate_t>::value();
0964   }
0965 };
0966 
0967 template <typename T>
0968 struct static_query<T, execution::inline_exception_handling_t::propagate_t,
0969   enable_if_t<
0970     execution::detail::inline_exception_handling::propagate_t<0>::
0971       query_static_constexpr_member<T>::is_valid
0972   >>
0973 {
0974   static constexpr bool is_valid = true;
0975   static constexpr bool is_noexcept = true;
0976 
0977   typedef typename execution::detail::inline_exception_handling::
0978     propagate_t<0>::query_static_constexpr_member<T>::result_type result_type;
0979 
0980   static constexpr result_type value()
0981   {
0982     return execution::detail::inline_exception_handling::propagate_t<0>::
0983       query_static_constexpr_member<T>::value();
0984   }
0985 };
0986 
0987 template <typename T>
0988 struct static_query<T, execution::inline_exception_handling_t::propagate_t,
0989   enable_if_t<
0990     !execution::detail::inline_exception_handling::propagate_t<0>::
0991         query_static_constexpr_member<T>::is_valid
0992       && !execution::detail::inline_exception_handling::propagate_t<0>::
0993         query_member<T>::is_valid
0994       && !traits::query_free<T,
0995         execution::inline_exception_handling_t::propagate_t>::is_valid
0996       && !can_query<T,
0997         execution::inline_exception_handling_t::capture_t>::value
0998       && !can_query<T,
0999         execution::inline_exception_handling_t::terminate_t>::value
1000   >>
1001 {
1002   static constexpr bool is_valid = true;
1003   static constexpr bool is_noexcept = true;
1004 
1005   typedef execution::inline_exception_handling_t::propagate_t result_type;
1006 
1007   static constexpr result_type value()
1008   {
1009     return result_type();
1010   }
1011 };
1012 
1013 template <typename T>
1014 struct static_query<T, execution::inline_exception_handling_t::capture_t,
1015   enable_if_t<
1016     execution::detail::inline_exception_handling::capture_t<0>::
1017       query_static_constexpr_member<T>::is_valid
1018   >>
1019 {
1020   static constexpr bool is_valid = true;
1021   static constexpr bool is_noexcept = true;
1022 
1023   typedef typename execution::detail::inline_exception_handling::
1024     capture_t<0>::query_static_constexpr_member<T>::result_type result_type;
1025 
1026   static constexpr result_type value()
1027   {
1028     return execution::detail::inline_exception_handling::capture_t<0>::
1029       query_static_constexpr_member<T>::value();
1030   }
1031 };
1032 
1033 template <typename T>
1034 struct static_query<T, execution::inline_exception_handling_t::terminate_t,
1035   enable_if_t<
1036     execution::detail::inline_exception_handling::terminate_t<0>::
1037       query_static_constexpr_member<T>::is_valid
1038   >>
1039 {
1040   static constexpr bool is_valid = true;
1041   static constexpr bool is_noexcept = true;
1042 
1043   typedef typename execution::detail::inline_exception_handling::
1044     terminate_t<0>::query_static_constexpr_member<T>::result_type result_type;
1045 
1046   static constexpr result_type value()
1047   {
1048     return execution::detail::inline_exception_handling::terminate_t<0>::
1049       query_static_constexpr_member<T>::value();
1050   }
1051 };
1052 
1053 #endif // !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
1054        //   || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
1055 
1056 } // namespace traits
1057 
1058 #endif // defined(GENERATING_DOCUMENTATION)
1059 
1060 } // namespace asio
1061 } // namespace boost
1062 
1063 #include <boost/asio/detail/pop_options.hpp>
1064 
1065 #endif // BOOST_ASIO_EXECUTION_INLINE_EXCEPTION_HANDLING_HPP