Return a datum referring to the specified string without copying it.

Synopsis

Declared in <bdld_datum.h>

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

Description

Return, by value, a datum that refers to 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 `string is not copied, and is not freed if Datum::destroy is called on the returned object.

Return Value

a datum referring to the specified string without copying it

Parameters

Name

Description

string

UTF‐8 string to reference

length

length of string in bytes

allocator

memory allocator to use

Created with MrDocs