C++: Difference between revisions

504 bytes added ,  3 February 2020
Line 265: Line 265:
====std::find====
====std::find====
[https://en.cppreference.com/w/cpp/algorithm/find Reference]<br>
[https://en.cppreference.com/w/cpp/algorithm/find Reference]<br>
===Numeric===
====std::iota====
[https://en.cppreference.com/w/cpp/algorithm/iota Reference]<br>
Fills an array or vector with increasing values. Can pass in a starting number.
<syntaxhighlight lang="cpp">
std::vector<int> v(60);
std::iota(v.begin(), v.end(), 0);
</syntaxhighlight>
====std::accumulate====
Adds up numbers. Can pass in a starting number.
<syntaxhighlight lang="cpp">
std::vector<int> v(60);
std::iota(v.begin(), v.end(), 0);
std::accumulate(v.begin(), v.end(), 0);
</syntaxhighlight>


===Chrono===
===Chrono===