aboutsummaryrefslogtreecommitdiff
path: root/src/cxx.cc
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2021-04-28 00:29:55 -0700
committerDavid Tolnay <dtolnay@gmail.com>2021-04-28 00:32:11 -0700
commit99f79c0677eb1144af717fb242c184c9de590fd6 (patch)
treeec9280eb044b85edb02dc4edf7f1228d34a1a327 /src/cxx.cc
parent1d0556e0687c41ac564938f8d8579f3aab0e524c (diff)
downloadcxx-99f79c0677eb1144af717fb242c184c9de590fd6.tar.gz
Add 'bool empty() const noexcept' to Str, String
Diffstat (limited to 'src/cxx.cc')
-rw-r--r--src/cxx.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cxx.cc b/src/cxx.cc
index b9168a87..ecfc1c69 100644
--- a/src/cxx.cc
+++ b/src/cxx.cc
@@ -131,6 +131,8 @@ std::size_t String::length() const noexcept {
return cxxbridge1$string$len(this);
}
+bool String::empty() const noexcept { return this->size() == 0; }
+
const char *String::c_str() noexcept {
auto len = this->length();
cxxbridge1$string$reserve_total(this, len + 1);
@@ -228,6 +230,8 @@ std::size_t Str::size() const noexcept { return cxxbridge1$str$len(this); }
std::size_t Str::length() const noexcept { return this->size(); }
+bool Str::empty() const noexcept { return this->size() == 0; }
+
Str::const_iterator Str::begin() const noexcept { return this->cbegin(); }
Str::const_iterator Str::end() const noexcept { return this->cend(); }