Are pointers initialized to nullptr in a vector?
About the only advantage I know of is that the pointer containers propagate constness. That is if you have a const_iterator to a ptr_vector you can't modify the stored object through that iterator, but a const_iterator to a std::vector of std::unique_ptrs can still be used to modify the pointed to objects.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement