String::String(const std::string& str)
: cstr_(0), len_(0)
{
- if (!str.empty())
- {
- size_t len = str.size();
- if (len) memcpy(allocate(len), str.c_str(), len);
- }
+ size_t len = str.size();
+ if (len) memcpy(allocate(len), str.c_str(), len);
}
inline
String& String::operator = (const std::string& str)
{
deallocate();
- if (!str.empty())
- {
- size_t len = str.size();
- if (len) memcpy(allocate(len), str.c_str(), len);
- }
+ size_t len = str.size();
+ if (len) memcpy(allocate(len), str.c_str(), len);
return *this;
}