commit 028bda7: [Minor] Add some more helpers
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun Oct 3 11:56:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-10-03 12:52:23 +0100
URL: https://github.com/rspamd/rspamd/commit/028bda7293b7ed3c908b0a35db9d48e4e411cfb5 (HEAD -> master)
[Minor] Add some more helpers
---
src/libmime/mime_string.hxx | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/libmime/mime_string.hxx b/src/libmime/mime_string.hxx
index 3294cd980..890708de2 100644
--- a/src/libmime/mime_string.hxx
+++ b/src/libmime/mime_string.hxx
@@ -310,19 +310,19 @@ public:
const Allocator& alloc = Allocator()) noexcept :
basic_mime_string(st.data(), st.size(), std::forward<filter_type>(filt), alloc) {}
- auto size() const -> std::size_t {
+ constexpr auto size() const noexcept -> std::size_t {
return storage.size();
}
- auto data() const -> const CharT* {
+ constexpr auto data() const noexcept -> const CharT* {
return storage.data();
}
- constexpr auto has_zeroes() const -> bool {
+ constexpr auto has_zeroes() const noexcept -> bool {
return !!(flags & mime_string_flags::MIME_STRING_SEEN_ZEROES);
}
- constexpr auto has_invalid() const -> bool {
+ constexpr auto has_invalid() const noexcept -> bool {
return !!(flags & mime_string_flags::MIME_STRING_SEEN_INVALID);
}
@@ -476,12 +476,15 @@ public:
return view_type{storage};
}
- constexpr CharT operator[](std::size_t pos) const {
+ constexpr CharT operator[](std::size_t pos) const noexcept {
return storage[pos];
}
constexpr CharT at(std::size_t pos) const {
return storage.at(pos);
}
+ constexpr bool empty() const noexcept {
+ return storage.empty();
+ }
/* For doctest stringify */
More information about the Commits
mailing list