You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by bk...@apache.org on 2022/11/18 14:18:09 UTC
[arrow] branch feature/format-string-view updated: delete potentially internal viewing members for rvalues
This is an automated email from the ASF dual-hosted git repository.
bkietz pushed a commit to branch feature/format-string-view
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/feature/format-string-view by this push:
new 51b5fd7355 delete potentially internal viewing members for rvalues
51b5fd7355 is described below
commit 51b5fd73556bbfaf9f918ca4e0230f79ef0353cf
Author: Benjamin Kietzman <be...@gmail.com>
AuthorDate: Fri Nov 18 09:16:11 2022 -0500
delete potentially internal viewing members for rvalues
---
cpp/src/arrow/util/string_header.h | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/cpp/src/arrow/util/string_header.h b/cpp/src/arrow/util/string_header.h
index 8ba18a8366..e3e9d9d69c 100644
--- a/cpp/src/arrow/util/string_header.h
+++ b/cpp/src/arrow/util/string_header.h
@@ -83,7 +83,7 @@ struct StringHeader {
StringHeader(const char* data, size_t len) : size_(static_cast<uint32_t>(len)) {
if (size_ == 0) return;
- // TODO: better option than assert?
+ // TODO(bkietz) better option than assert?
assert(data);
if (IsInline()) {
// small string: inlined. Bytes beyond size_ are already 0
@@ -118,7 +118,8 @@ struct StringHeader {
static constexpr bool IsInline(uint32_t size) { return size <= kInlineSize; }
- const char* data() const { return IsInline() ? prefix_.data() : value_.data; }
+ const char* data() const& { return IsInline() ? prefix_.data() : value_.data; }
+ const char* data() && = delete;
size_t size() const { return size_; }
@@ -179,11 +180,14 @@ struct StringHeader {
std::string GetString() const { return std::string(data(), size()); }
- explicit operator std::string_view() const { return std::string_view(data(), size()); }
+ explicit operator std::string_view() const& { return std::string_view(data(), size()); }
+ operator std::string_view() && = delete;
- const char* begin() const { return data(); }
+ const char* begin() const& { return data(); }
+ const char* end() const& { return data() + size(); }
- const char* end() const { return data() + size(); }
+ const char* begin() && = delete;
+ const char* end() && = delete;
bool empty() const { return size() == 0; }