Even making this type non-const saves you at best an allocation. Your best bet is `const std::string&` if insisting on strings but this has other issues mainly that you can't allocate a `constexpr std::string` in the class for returning and have to use the Meyer's singleton pattern, and its overhead, to allocate a single instance and return it multiple times.
This also falls apart in the managed wrapper where you will want to get the real type name from the managed object as a .NET string but have to convert that to an unmanaged `std:string` of which you can't return a reference to. You would have to do a more complicated non-static singleton pattern for this to avoid additional allocations. [ Full content available at: https://github.com/apache/geode-native/pull/339 ] This message was relayed via gitbox.apache.org for [email protected]
