Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / outcome / experimental / status_result.hpp
index 9f362d6..6078356 100644 (file)
@@ -38,6 +38,39 @@ DEALINGS IN THE SOFTWARE.
 
 BOOST_OUTCOME_V2_NAMESPACE_EXPORT_BEGIN
 
+namespace trait
+{
+  namespace detail
+  {
+    // Shortcut this for lower build impact. Used to tell outcome's converting constructors
+    // that they can do E => EC or E => EP as necessary.
+    template <class DomainType> struct _is_error_code_available<BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::status_code<DomainType>>
+    {
+      static constexpr bool value = true;
+      using type = BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::status_code<DomainType>;
+    };
+    template <class DomainType> struct _is_error_code_available<BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::errored_status_code<DomainType>>
+    {
+      static constexpr bool value = true;
+      using type = BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::errored_status_code<DomainType>;
+    };
+  }  // namespace detail
+#if 0  // Do NOT enable weakened implicit construction for these types
+  template <class DomainType> struct is_error_type<BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::status_code<DomainType>>
+  {
+    static constexpr bool value = true;
+  };
+  template <> struct is_error_type<BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::errc>
+  {
+    static constexpr bool value = true;
+  };
+  template <class DomainType, class Enum> struct is_error_type_enum<BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE::status_code<DomainType>, Enum>
+  {
+    static constexpr bool value = boost::system::is_error_condition_enum<Enum>::value;
+  };
+#endif
+}  // namespace trait
+
 namespace detail
 {
   // Customise _set_error_is_errno