> Manual memory management is the most popular misconception of C++. Since C++11, it is now recommended to use std::shared_ptr or std::unique_ptr for automatic memory management. There is a small computational cost to maintaining referenced pointers but it’s minuscule and the safety outweighs this cost. I think another misconception is that you need pointers at all. Smart pointers are still pointers. Its better to us…
Because copying the entire in-memory database you're using on every function call is kind of expensive?
For instance this does not do any expensive copies:
std::string getStr() { auto huge_str = getDatabaseDump(); return huge_str; }
void readStr(const std::string& str ){ //read str.. }
int main() { auto str = getStr(); readStr(str); }