Commit 9f0f5c60 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

ImmutableString: Remove std::unique_ptr<char[]> ctor overload

parent 09de3320
......@@ -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());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment