util/AllocatedString: add const_pointer constructor
This commit is contained in:
parent
a81c9bfb81
commit
8d47f51399
@ -65,7 +65,10 @@ public:
|
|||||||
BasicAllocatedString(std::nullptr_t n) noexcept
|
BasicAllocatedString(std::nullptr_t n) noexcept
|
||||||
:value(n) {}
|
:value(n) {}
|
||||||
|
|
||||||
explicit BasicAllocatedString(string_view src) noexcept
|
explicit BasicAllocatedString(string_view src)
|
||||||
|
:value(Duplicate(src)) {}
|
||||||
|
|
||||||
|
explicit BasicAllocatedString(const_pointer src)
|
||||||
:value(Duplicate(src)) {}
|
:value(Duplicate(src)) {}
|
||||||
|
|
||||||
BasicAllocatedString(BasicAllocatedString &&src) noexcept
|
BasicAllocatedString(BasicAllocatedString &&src) noexcept
|
||||||
@ -144,6 +147,12 @@ private:
|
|||||||
*std::copy_n(src.data(), src.size(), p) = SENTINEL;
|
*std::copy_n(src.data(), src.size(), p) = SENTINEL;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pointer Duplicate(const_pointer src) {
|
||||||
|
return src != nullptr
|
||||||
|
? Duplicate(std::string_view(src))
|
||||||
|
: nullptr;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AllocatedString : public BasicAllocatedString<char> {
|
class AllocatedString : public BasicAllocatedString<char> {
|
||||||
|
Loading…
Reference in New Issue
Block a user