BloombergLP::bdld::Datum::copyString

Return a datum owning a copy of the specified string.

Synopsis

Declared in <bdld_datum.h>

static
Datum
copyString(
    char const* string,
    SizeType length,
    AllocatorType const& allocator);

Description

Return, by value, a datum that refers to the copy of the specified string having the specified length, using the specified allocator to supply memory (if needed). The behavior is undefined unless `0 != string || 0 == length. The behavior is also undefined unless length <= UINT_MAX`. Note that the copied string is owned and will be freed if Datum::destroy is called on the returned object.

Return Value

a datum owning a copy of the specified string

Parameters

NameDescription
stringUTF-8 string to copy
lengthlength of string in bytes
allocatormemory allocator to use