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