tempCString produces C string for given string. Result is wrapped
in CStringHolder record.
If input is already a C string, then input is simply stored in a
POD CStringHolder.
If input is a string but not a C string, then memory for C string
is allocated, string data is copied to that string, and allocated
C string is stored in CStringHolder record. In this case CStringHolder
owns cstring reference and releases it on destroy.
tempCString is convenient to call C APIs that accept
C strings. Code example:
Currently memory is allocated using malloc. Later tempCString may
be rewritten to allocate memory in a thread-local fixed size memory
chunk pool (in this case the cost of memory allocation will be
comparable to alloca).
tempCString
produces C string for given string. Result is wrapped in CStringHolder record.If input is already a C string, then input is simply stored in a POD CStringHolder.
If input is a string but not a C string, then memory for C string is allocated, string data is copied to that string, and allocated C string is stored in CStringHolder record. In this case CStringHolder owns cstring reference and releases it on destroy.
tempCString is convenient to call C APIs that accept C strings. Code example:
Currently memory is allocated using malloc. Later tempCString may be rewritten to allocate memory in a thread-local fixed size memory chunk pool (in this case the cost of memory allocation will be comparable to
alloca
).