]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/outcome/experimental/status-code/status_code_ptr.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / outcome / experimental / status-code / status_code_ptr.hpp
index 2baf4c6ad4d57f64c4651899169b9e7584f0b6a5..8b72b1ce247fb7a59d09858478239f34ec80fbce 100644 (file)
@@ -1,5 +1,5 @@
 /* Pointer to a SG14 status_code
-(C) 2018-2020 Niall Douglas <http://www.nedproductions.biz/> (5 commits)
+(C) 2018-2022 Niall Douglas <http://www.nedproductions.biz/> (5 commits)
 File Created: Sep 2018
 
 
@@ -99,6 +99,7 @@ namespace detail
       assert(code.domain() == *this);
       const auto &c = static_cast<const _mycode &>(code);  // NOLINT
       typename StatusCode::domain_type()._do_throw_exception(*c.value());
+      abort();  // suppress buggy GCC warning
     }
 #endif
     virtual void _do_erased_copy(status_code<void> &dst, const status_code<void> &src, size_t /*unused*/) const override  // NOLINT
@@ -128,7 +129,8 @@ This is useful for shoehorning a rich status code with large value type into a s
 erased status code like `system_code`, with which the status code generated by this
 function is compatible. Note that this function can throw due to `bad_alloc`.
 */
-template <class T, typename std::enable_if<is_status_code<T>::value, bool>::type = true>  //
+BOOST_OUTCOME_SYSTEM_ERROR2_TEMPLATE(class T)
+BOOST_OUTCOME_SYSTEM_ERROR2_TREQUIRES(BOOST_OUTCOME_SYSTEM_ERROR2_TPRED(is_status_code<T>::value))  //
 inline status_code<erased<typename std::add_pointer<typename std::decay<T>::type>::type>> make_status_code_ptr(T &&v)
 {
   using status_code_type = typename std::decay<T>::type;
@@ -138,13 +140,15 @@ inline status_code<erased<typename std::add_pointer<typename std::decay<T>::type
 /*! If a status code refers to a `status_code_ptr` which indirects to a status
 code of type `StatusCode`, return a pointer to that `StatusCode`. Otherwise return null.
 */
-template <class StatusCode, class U, typename std::enable_if<is_status_code<StatusCode>::value, bool>::type = true> inline StatusCode *get_if(status_code<erased<U>> *v) noexcept
+BOOST_OUTCOME_SYSTEM_ERROR2_TEMPLATE(class StatusCode, class U)
+BOOST_OUTCOME_SYSTEM_ERROR2_TREQUIRES(BOOST_OUTCOME_SYSTEM_ERROR2_TPRED(is_status_code<StatusCode>::value)) inline StatusCode *get_if(status_code<erased<U>> *v) noexcept
 {
   if((0xc44f7bdeb2cc50e9 ^ typename StatusCode::domain_type().id()) != v->domain().id())
   {
     return nullptr;
   }
-  union {
+  union
+  {
     U value;
     StatusCode *ret;
   };
@@ -152,13 +156,16 @@ template <class StatusCode, class U, typename std::enable_if<is_status_code<Stat
   return ret;
 }
 //! \overload Const overload
-template <class StatusCode, class U, typename std::enable_if<is_status_code<StatusCode>::value, bool>::type = true> inline const StatusCode *get_if(const status_code<erased<U>> *v) noexcept
+BOOST_OUTCOME_SYSTEM_ERROR2_TEMPLATE(class StatusCode, class U)
+BOOST_OUTCOME_SYSTEM_ERROR2_TREQUIRES(BOOST_OUTCOME_SYSTEM_ERROR2_TPRED(is_status_code<StatusCode>::value))
+inline const StatusCode *get_if(const status_code<erased<U>> *v) noexcept
 {
   if((0xc44f7bdeb2cc50e9 ^ typename StatusCode::domain_type().id()) != v->domain().id())
   {
     return nullptr;
   }
-  union {
+  union
+  {
     U value;
     const StatusCode *ret;
   };