Last active
December 1, 2021 11:38
-
-
Save HappyCerberus/7cb12412d72ee70099a9daf641ee88fb to your computer and use it in GitHub Desktop.
solution-aoc-day1-part1
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
#include <algorithm> | |
#include <istream> | |
#include <limits> | |
#include <ranges> | |
#include <utility> | |
uint32_t count_increasing(std::istream &input) { | |
return std::ranges::count_if( | |
std::ranges::istream_view<uint32_t>(input), | |
[prev = std::numeric_limits<uint32_t>::max()](uint32_t curr) mutable | |
{ return std::exchange(prev, curr) < curr; }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment