Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
But use it only if you really can't figure out how much memory you actually need, and even then don't use it in time critical code parts.
-
CptFox16196yDisagree: look for shared_ptr and weak_ptr, and say goodbye to memory leaks and segfaults.
-
The coolest part of modern C++ is having regular expressions in the standard. I've waited two decades for it to happen!
Why are people so obsessed with vector?
If you really need continuous memory for the access speed, use array.
If you just need a comfortable container, use list.
There aren't that many reasons to use vector...
... And hash containers are much cooler! 😁 -
@FrodoSwaggins Depends. The thing that must not happen in time critical parts is putting in another element that triggers malloc behind the scenes. Not only that this can be slow, the runtime even varies a lot. But that's the one feature that discerns std::vector from std::array, not bounds checking.
I think vector is the coolest type in c++
random