Intialize StringView fields to default values/
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
25772e7d5a
commit
97b15650f1
|
@ -5,8 +5,8 @@
|
|||
namespace ArbUt {
|
||||
class BasicStringView {
|
||||
protected:
|
||||
size_t _length;
|
||||
uint32_t _hash;
|
||||
size_t _length = 0;
|
||||
uint32_t _hash = 0;
|
||||
|
||||
constexpr BasicStringView(size_t length, uint32_t hash) : _length(length), _hash(hash) {}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace ArbUt {
|
||||
class __ConstStringCharHolder {
|
||||
char* _value;
|
||||
char* _value = 0;
|
||||
|
||||
__ConstStringCharHolder(const __ConstStringCharHolder& o) = delete;
|
||||
__ConstStringCharHolder& operator=(const __ConstStringCharHolder& other) = delete;
|
||||
|
@ -43,14 +43,14 @@ namespace ArbUt {
|
|||
static std::shared_ptr<__ConstStringCharHolder> __emptyString;
|
||||
static inline const std::shared_ptr<__ConstStringCharHolder>& GetEmptyString() { return __emptyString; }
|
||||
|
||||
std::shared_ptr<__ConstStringCharHolder> _str;
|
||||
std::shared_ptr<__ConstStringCharHolder> _str = GetEmptyString();
|
||||
|
||||
public:
|
||||
StringView(const char* str) noexcept
|
||||
: BasicStringView(CalcLength(str), Hash(str)), _str(new __ConstStringCharHolder(str, CalcLength(str))) {}
|
||||
StringView(const char* str, size_t length) noexcept
|
||||
: BasicStringView(length, Hash(str)), _str(new __ConstStringCharHolder(str, length)) {}
|
||||
StringView() noexcept : BasicStringView(0, Hash("")), _str(GetEmptyString()) {}
|
||||
StringView() noexcept : BasicStringView(0, Hash("")) {}
|
||||
|
||||
/* Copy operators */
|
||||
StringView(const StringView& other) noexcept : BasicStringView(other._length, other._hash), _str(other._str) {}
|
||||
|
|
Loading…
Reference in New Issue