Quantcast
Channel: What's the fastest way to reinitialize a vector? - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by Alan Birtles for What's the fastest way to reinitialize a vector?

In order to determine the fastest way you will need to run some benchmarks.There are a number of different ways to "reinitialise" a vector:Call clear(), for trivial types this should be roughly...

View Article



Answer by eerorika for What's the fastest way to reinitialize a vector?

What is the fastest way to reset all values for a large vector to its default values?Depends on what vector in its "default values" means.If you want to remove all elements, most efficient is...

View Article

Answer by Useless for What's the fastest way to reinitialize a vector?

What's the fastest way to reinitialize a vector?Don't.Just record the fact that the vector has no valid entries by calling clear(). This has the advantage of being both (probably) optimal, and...

View Article

What's the fastest way to reinitialize a vector?

What is the fastest way to reset all values for a large vector to its default values?struct foo{ int id; float score;};std::vector<foo> large_vector(10000000);The simplest way would be to create...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images