xo-object2: + DString.from_str()

This commit is contained in:
Roland Conybeare 2026-01-25 10:03:41 -05:00
commit 5f5469637a
2 changed files with 15 additions and 0 deletions

View file

@ -78,6 +78,12 @@ namespace xo {
static DString * from_view(obj<AAllocator> mm,
std::string_view sv);
/** create string containing a copy @p str.
* Use memory from allocator @p mm.
**/
static DString * from_str(obj<AAllocator> mm,
const std::string & str);
/** create string containing a copy of @p sv.
* Use memory from allocator @p mm via sub_alloc.
* (load-bearing for StringTable)

View file

@ -91,6 +91,15 @@ namespace xo {
return _from_view_aux(mm, sv, false /*!suballoc_flag*/);
}
DString *
DString::from_str(obj<AAllocator> mm,
const std::string & str)
{
return _from_view_aux(mm,
std::string_view(str),
false /*!suballoc_flag*/);
}
DString *
DString::from_view_suballoc(obj<AAllocator> mm,
std::string_view sv)