I wonder if it'd work to add a guaranteed non-null pointer to C++ like this:
https://gist.github.com/uliwitness/931873c0b2edaa537b905418a024be04
#CPlusPlus #optionals #shared_ptr
Update: The gist is now fully compiling code.
I wonder if it'd work to add a guaranteed non-null pointer to C++ like this:
https://gist.github.com/uliwitness/931873c0b2edaa537b905418a024be04
#CPlusPlus #optionals #shared_ptr
Update: The gist is now fully compiling code.
TIL that std::shared_ptr has a custom "deleter" function you can set for actually deleting the memory. Seems to make for a pretty nice way to create a memory buffer manager. I need to shuffle a lot of smallish buffers and allocating/freeing memory all the time is not particularly efficient, especially not when time is essential. I guess this is nothing new to the veterans out there, but it'll make my life easier.
weak_from_this
か・・・なるほど。
enable_shared_from_this の C++2011(14) と C++2017 との相違点 by yuki12 https://qiita.com/yuki12/items/ccbe5cf8cf06ffa1fc66 #Qiita #Cpp #Cpp11 #Cpp17 #shared_ptr