Skip to content

Instantly share code, notes, and snippets.

@HappyCerberus
Last active December 1, 2021 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HappyCerberus/7cb12412d72ee70099a9daf641ee88fb to your computer and use it in GitHub Desktop.
Save HappyCerberus/7cb12412d72ee70099a9daf641ee88fb to your computer and use it in GitHub Desktop.
solution-aoc-day1-part1
#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