BLI: add StringRefNull.c_str() method

This should be used whenever you rely on the fact, that the
returned pointer points to the beginning of a null-terminated array.
This commit is contained in:
2020-07-17 12:38:15 +02:00
parent 0fcd23a388
commit 0e3d34e48f
5 changed files with 15 additions and 5 deletions

View File

@@ -240,7 +240,7 @@ class MFNetworkBuilderBase {
BLI_STATIC_ASSERT((std::is_base_of_v<fn::MultiFunction, T>), "");
void *buffer = common_.resources.linear_allocator().allocate(sizeof(T), alignof(T));
T *fn = new (buffer) T(std::forward<Args>(args)...);
common_.resources.add(destruct_ptr<T>(fn), fn->name().data());
common_.resources.add(destruct_ptr<T>(fn), fn->name().c_str());
return *fn;
}
};