ImmutableString: Remove std::unique_ptr<char[]> ctor overload
This commit is contained in:
parent
09de332028
commit
9f0f5c60ad
|
@ -232,10 +232,6 @@ public:
|
|||
ImmutableString(const char *s, size_t slen)
|
||||
: len(slen), base(copystr(s, len)) {}
|
||||
ImmutableString(const char *s) : len(strlen(s)), base(copystr(s, len)) {}
|
||||
ImmutableString(std::unique_ptr<char[]> s)
|
||||
: len(strlen(s.get())), base(len == 0 ? "" : s.release()) {}
|
||||
ImmutableString(std::unique_ptr<char[]> s, size_t slen)
|
||||
: len(slen), base(len == 0 ? "" : s.release()) {}
|
||||
ImmutableString(const std::string &s)
|
||||
: len(s.size()), base(copystr(s.c_str(), s.size())) {}
|
||||
template <typename InputIt>
|
||||
|
|
|
@ -50,20 +50,16 @@ void test_template_immutable_string(void) {
|
|||
CU_ASSERT(std::string("alpha") == from_cstr);
|
||||
CU_ASSERT(from_cstr == std::string("alpha"));
|
||||
|
||||
ImmutableString from_uniq(strcopy("charlie"));
|
||||
|
||||
CU_ASSERT("charlie" == from_uniq);
|
||||
CU_ASSERT(7 == from_uniq.size());
|
||||
|
||||
// copy constructor
|
||||
ImmutableString copy = from_uniq;
|
||||
ImmutableString src("charlie");
|
||||
ImmutableString copy = src;
|
||||
|
||||
CU_ASSERT("charlie" == copy);
|
||||
CU_ASSERT(7 == copy.size());
|
||||
|
||||
// copy assignment
|
||||
ImmutableString copy2;
|
||||
copy2 = from_uniq;
|
||||
copy2 = src;
|
||||
|
||||
CU_ASSERT("charlie" == copy2);
|
||||
CU_ASSERT(7 == copy2.size());
|
||||
|
|
Loading…
Reference in New Issue