Created
June 30, 2021 19:59
-
-
Save brycelelbach/e66c7d7612cefba2ba86bfef8ce30a62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::vector v = ...; | |
auto min = std::ranges::min_element(v); | |
std::ranges::for_each(v, [&] (auto& e) { e /= min; }); | |
std::vector v = ...; | |
auto min = std::ranges::min_element(v); | |
std::ranges::transform(v, v.begin(), [&] (auto e) { return e / min; }); | |
std::vector v = ...; | |
auto min = std::ranges::min_element(v); | |
for (auto& e : v) e /= min; | |
std::vector v = ...; | |
auto min = std::ranges::min_element(v); | |
for (std::size_t i = 0; i < v.size(); ++i) e[i] /= min; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment