3 ms·
Sounds like you should be using shared_ptr! It guarantees to keep the object around.
by randyrand 7y ago
Sounds like you should be using shared_ptr! It guarantees to keep the object around.
- fauigerzigerk 7y agoIf it's my choice to make and it's not performance critical code then I can do that. But in many cases I'm using APIs designed by others. Most older libraries come with their own idiosyncratic memory management patterns. Even the standard library has lots of different ways of passing reference-like things around. E.g. https://en.cppreference.com/w/cpp/string/basic_string_view/basic_string_view https://en.cppreference.com/w/cpp/string/basic_string_view/b...