![](https://1.bp.blogspot.com/-gPp3qoA4Dk4/X15tUnICdrI/AAAAAAAAEvo/kjVZvvjehmogIFnmFx6QF9CitcKHwVqiQCLcBGAsYHQ/s0/pvschecking.png)
Since a few months, I've been refactoring my old C++/OpenGL project. Thus far, I used compilers (MSVC and Clang), my knowledge or free tools. At some point, I also got a chance to leverage a solid static analysis tool - PVS-Studio. The tool helped me with identifying 8 critical issues not to mention good code style and performance enhancements (in total 137 warnings)
Read on to see my report.
Replacing Unique_ptr With C++17’s std::variant — a Practical Experiment
![](https://1.bp.blogspot.com/-GZUf7pE_Mz8/X1U2JXvGsHI/AAAAAAAAEus/9tWxgy7RA8s4ah1z_uikvMELARFwxBUhACLcBGAsYHQ/s0/replacing_into_variant.png)
Some time ago I wrote about a new way to implement runtime polymorphism which is based not on virtual functions but on std::visit
and std::variant
. Please have a look at this new blog post where I experiment with this approach on my home project. The experiment is more practical than artificial examples.
See advantages, disadvantages and practical code issues.