epfl-lasa / wiki

Best practices, conventions, manuals and instructions for researchers at the LASA
5 stars 1 forks source link

Modern C++ (pointers) #7

Open hubernikus opened 3 years ago

hubernikus commented 3 years ago

What are your thoughts about modern (smart) pointer styles? Should we use this for recommendations in the style guide? https://docs.microsoft.com/en-us/cpp/cpp/smart-pointers-modern-cpp?view=msvc-160

niederha commented 1 year ago

Ahaha I just saw this. In my opinion shared pointers and unique pointers are now part of standard modern c++. They should be used mindfully (it is not an excuse to stop managing your memory) but it is a very useful tool to make your program safer and cuts a lot of boilerplate. This is an extremely good tool for mutli-threading for example.