Add support for simple empty StringView.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
18c7c3ddcb
commit
d8c3fe1436
|
@ -4,4 +4,7 @@
|
||||||
namespace ArbUt {
|
namespace ArbUt {
|
||||||
std::shared_ptr<__ConstStringCharHolder> StringView::__emptyString =
|
std::shared_ptr<__ConstStringCharHolder> StringView::__emptyString =
|
||||||
std::make_shared<__ConstStringCharHolder>("", 0);
|
std::make_shared<__ConstStringCharHolder>("", 0);
|
||||||
|
|
||||||
|
static StringView __empty;
|
||||||
|
const StringView& StringView::Empty() { return __empty; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,8 @@ namespace ArbUt {
|
||||||
CalculateHash(const std::string_view& val) noexcept {
|
CalculateHash(const std::string_view& val) noexcept {
|
||||||
return Hash(val.data());
|
return Hash(val.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const StringView& Empty();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,4 +76,9 @@ TEST_CASE("Out of scope char* doesn't lose reference", "[Utilities]") {
|
||||||
REQUIRE(strcmp(val.c_str(), "foobar") == 0);
|
REQUIRE(strcmp(val.c_str(), "foobar") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Get Empty String", "[Utilities]") {
|
||||||
|
REQUIRE(ArbUt::StringView::Empty() == ""_cnc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue