TimonKnigge / TCR

Team Code Reference for programming contests
24 stars 5 forks source link

std::iota #5

Open RagnarGrootKoerkamp opened 7 years ago

RagnarGrootKoerkamp commented 7 years ago

What about changing

for(size_t i=0; i<v.size(); ++i) v[i] = i;

to

iota(v.begin(), v.end(), 0);

?

For example here: https://github.com/TimonKnigge/TCR/blob/master/snippets/datastructures/unionfind.cpp#L5

@TimonKnigge

TimonKnigge commented 5 years ago

More generally, std::equal, std::copy, etc