]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/outcome/experimental/status-code/win32_code.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / outcome / experimental / status-code / win32_code.hpp
index 57f4e56a4547dbf162f594edb71973af160a8cd2..4de0f9cbf7c07488a0e0659aa9cb2fe2700820c9 100644 (file)
@@ -35,7 +35,7 @@ DEALINGS IN THE SOFTWARE.
 #error This file should only be included on Windows
 #endif
 
-#include "generic_code.hpp"
+#include "quick_status_code_from_enum.hpp"
 
 BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE_BEGIN
 
@@ -69,6 +69,17 @@ using win32_code = status_code<_win32_code_domain>;
 //! (Windows only) A specialisation of `status_error` for the Win32 error code domain.
 using win32_error = status_error<_win32_code_domain>;
 
+namespace mixins
+{
+  template <class Base> struct mixin<Base, _win32_code_domain> : public Base
+  {
+    using Base::Base;
+
+    //! Returns a `win32_code` for the current value of `GetLastError()`.
+    static inline win32_code current() noexcept;
+  };
+}  // namespace mixins
+
 /*! (Windows only) The implementation of the domain for Win32 error codes, those returned by `GetLastError()`.
  */
 class _win32_code_domain : public status_code_domain
@@ -200,6 +211,11 @@ inline constexpr const _win32_code_domain &_win32_code_domain::get()
   return win32_code_domain;
 }
 
+namespace mixins
+{
+  template <class Base> inline win32_code mixin<Base, _win32_code_domain>::current() noexcept { return win32_code(win32::GetLastError()); }
+}  // namespace mixins
+
 BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE_END
 
 #endif