Browse Source

bugfix: use explicit cast to underlying_type

Sam Jaffe 2 năm trước cách đây
mục cha
commit
974596108e
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      include/opaque_typedef/opaque_typedef.hpp

+ 3 - 1
include/opaque_typedef/opaque_typedef.hpp

@@ -115,6 +115,8 @@ namespace types {
      */
     constexpr value_type const & get() const { return value_; }
     constexpr explicit operator value_type const &() const { return value_; }
-    constexpr underlying_type operator*() const { return value_; }
+    constexpr underlying_type operator*() const {
+      return static_cast<underlying_type>(value_);
+    }
   };
 }