Removed std::string_view ctor on StringView.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-06-27 14:24:43 +02:00
parent 083c00f85e
commit 9f5b8e9c83
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 2 additions and 11 deletions

View File

@ -1,3 +1,3 @@
#include "StringView.hpp"
ArbUt::__ConstStringCharHolder* ArbUt::StringView::__emptyString = new __ConstStringCharHolder(std::string_view("", 0));
ArbUt::__ConstStringCharHolder* ArbUt::StringView::__emptyString = new __ConstStringCharHolder("", 0);

View File

@ -23,19 +23,12 @@ namespace ArbUt {
__ConstStringCharHolder& operator=(const __ConstStringCharHolder& other) = delete;
public:
__ConstStringCharHolder(const std::string_view& value) noexcept
: _value(new char[value.length() + 1]), _references(1) {
strncpy(_value, value.data(), value.length() + 1);
}
__ConstStringCharHolder(const char* value, size_t length) noexcept
: _value(new char[length + 1]), _references(1) {
strncpy(_value, value, length + 1);
}
~__ConstStringCharHolder() noexcept {
delete[] _value;
_value = nullptr;
}
~__ConstStringCharHolder() noexcept { delete[] _value; }
inline void RemoveReference() noexcept {
if (--_references <= 0) {
@ -68,8 +61,6 @@ namespace ArbUt {
}
public:
StringView(const std::string_view& str) noexcept
: BasicStringView(str.length(), Hash(str.data())), _str(new __ConstStringCharHolder(str)) {}
StringView(const char* str) noexcept
: BasicStringView(CalcLength(str), Hash(str)), _str(new __ConstStringCharHolder(str, CalcLength(str))) {}
StringView(const char* str, size_t length) noexcept