Skip to content

Instantly share code, notes, and snippets.

@vbe0201
vbe0201 / day01.cpp
Last active December 3, 2021 19:11
My Advent of Code 2021 solutions written in C++
#include <algorithm>
#include <fstream>
#include <iostream>
#include <ranges>
#include <string>
void part1() {
std::ifstream input{"input.txt"};
auto view = std::ranges::istream_view<int>(input);
const std = @import("std");
const assert = std.debug.assert;
const cache_line = std.atomic.cache_line;
const AtomicUsize = std.atomic.Atomic(usize);
const Ordering = std.atomic.Ordering;
const Allocator = std.mem.Allocator;
// A modified version of Dmitry Vyukov's bounded MPMC queue,
// adapted for single-consumer usage: