You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "PragmaTwice (via GitHub)" <gi...@apache.org> on 2023/05/21 15:46:44 UTC

[GitHub] [incubator-kvrocks] PragmaTwice commented on issue #1462: avoid the implicit conversion from `const char *` to `string` in `Status.h`

PragmaTwice commented on issue #1462:
URL: https://github.com/apache/incubator-kvrocks/issues/1462#issuecomment-1556211361

   `Slice` is just a **view**, which has no **ownership**.
   For example, if we want to concat some string dynamicly, we cannot use `Slice` since it cannot extend lifetime of the object, e.g.
   ```
   string x = to_string(count) + " apples";
   return Slice(x); // dangling reference!
   ```
   
   BTW `Slice` is not a well-designed type, instead we have `std::string_view` since c++17.
   


-- 
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