Quick Q: Does the range-based for loop make std algorithms obsolete? -- StackOverflow

Here's a fine question from StackOverflow[C++11]. Click through for some fine answers.

Does the Range-based for Loop Make std Algorithms Obsolete?

Algorithm solution:

std::generate(numbers.begin(), numbers.end(), rand);

Range-based for-loop solution:

for (int& x : numbers) x = rand();

Why would I want to use the more verbose std::generate over range-based for-loops in C++11?

Continue reading...

 

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.