You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/12/20 12:20:23 UTC

[GitHub] [incubator-kvrocks] torwig commented on a diff in pull request #1198: Inplace construct error message in StatusOr while data type is large enough

torwig commented on code in PR #1198:
URL: https://github.com/apache/incubator-kvrocks/pull/1198#discussion_r1053255319


##########
src/common/status.h:
##########
@@ -105,11 +105,61 @@ class [[nodiscard]] Status {
   friend struct StatusOr;
 };
 
+namespace type_details {
 template <typename... Ts>
-using first_element = typename std::tuple_element<0, std::tuple<Ts...>>::type;
+using first_element_t = typename std::tuple_element_t<0, std::tuple<Ts...>>;
 
 template <typename T>
-using remove_cvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+using remove_cvref_t = typename std::remove_cv_t<typename std::remove_reference_t<T>>;
+};  // namespace type_details
+
+template <typename, typename = void>
+struct StringInStatusOr : private std::string {
+  using base_type = std::string;
+  static constexpr bool inplace = true;
+
+  explicit StringInStatusOr(std::string&& v) : base_type(std::move(v)) {}

Review Comment:
   Across the `Kvrocks` codebase, we place `&` and `*` near the value instead of near the type. So in order to keep the same code style, you can place them close to variables or the `operator` keyword. However, if there is an exception for templates or clang-format tool forces such syntax, it's OK.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org