From 70570eed35f1c24a20634696edd5b4bfa0a74b47 Mon Sep 17 00:00:00 2001 From: Bob Chen Date: Fri, 15 Dec 2023 19:37:01 +0800 Subject: [PATCH] rpc::string add empty method --- rpc/serialize.h | 1 + 1 file changed, 1 insertion(+) diff --git a/rpc/serialize.h b/rpc/serialize.h index 0aa327bd..d0ee6c46 100644 --- a/rpc/serialize.h +++ b/rpc/serialize.h @@ -105,6 +105,7 @@ namespace rpc const char* c_str() const { return cbegin(); } std::string_view sv() const { return {c_str(), size() - 1}; } std::string to_std() { return std::string(sv()); }; + bool empty() const { return _len == 0; } bool operator==(const string& rhs) const { return sv() == rhs.sv(); } bool operator!=(const string& rhs) const { return !(*this == rhs); } bool operator<(const string& rhs) const { return sv() < rhs.sv(); }