xo-object2: + DString::assign

This commit is contained in:
Roland Conybeare 2026-01-13 17:07:03 -05:00
commit 4c468d88e3
3 changed files with 108 additions and 0 deletions

View file

@ -4,6 +4,7 @@
**/
#include "DString.hpp"
#include <algorithm>
#include <cstring>
namespace xo {
@ -50,6 +51,18 @@ namespace xo {
return result;
}
DString &
DString::assign(const DString & other)
{
size_type n = std::min(other.size_, capacity_ - 1);
std::memcpy(chars_, other.chars_, n);
chars_[n] = '\0';
size_ = n;
return *this;
}
} /*namespace scm*/
} /*namespace xo*/