3 ms·
If you have not read, Modern C++ Design by Andrei Alexandrescu then you are doing your self a disfavor if you are interested in performance. While its a bit ol
by tfigment 12y ago
If you have not read, Modern C++ Design by Andrei Alexandrescu then you are doing your self a disfavor if you are interested in performance. While its a bit old I guess, the Loki library is/was a wonderful C++ library with very interesting and useful techniques that give the programmer control while preserving things like type safety.
The design here may also benefit from a custom allocator so that objects of same type are constructed in memory in a contiguous fashion. Especially if you want more than one vector of these objects in the code. The above book also has a number of smart pointer constructs that are probably similar to these pointers but with customizable behaviors and strategies.
As someone else mentioned when code hits the real world things tend to break down but if you are not following a good memory design to begin with you don't even have the hope of getting the better performing version.