tangled
alpha
login
or
join now
bpavuk.neocities.org
/
aoc25
0
fork
atom
Advent of Code 2025, done in C++
0
fork
atom
overview
issues
pulls
pipelines
day[04]: using `size_t` for managing sizes
bpavuk.neocities.org
3 months ago
e0355ea4
3cb7f065
verified
This commit was signed with the committer's
known signature
.
bpavuk.neocities.org
SSH Key Fingerprint:
SHA256:touU+q2GJ73PqWiLfYmysNddAYFLgyW6s7Jzarerajw=
+11
-10
1 changed file
expand all
collapse all
unified
split
src
04
solution.cxx
+11
-10
src/04/solution.cxx
···
1
1
+
#include <cstddef>
1
2
#include <filesystem>
2
3
#include <fstream>
3
4
#include <print>
···
17
18
}
18
19
};
19
20
20
20
-
unsigned long width() { return data[0].length(); }
21
21
+
std::size_t width() { return data[0].length(); }
21
22
22
22
-
unsigned long height() { return data.size(); }
23
23
+
std::size_t height() { return data.size(); }
23
24
24
24
-
std::string &operator[](unsigned long idx) { return data[idx]; }
25
25
+
std::string &operator[](std::size_t idx) { return data[idx]; }
25
26
26
26
-
const std::string &operator[](unsigned long idx) const { return data[idx]; }
27
27
+
const std::string &operator[](std::size_t idx) const { return data[idx]; }
27
28
28
28
-
std::string get_surrounding(unsigned long row, unsigned long col) {
29
29
+
std::string get_surrounding(std::size_t row, std::size_t col) {
29
30
std::string sur = "";
30
31
sur.resize(8);
31
31
-
unsigned long wid = width();
32
32
+
std::size_t wid = width();
32
33
auto hi = height();
33
34
34
35
if (row > 0 && col > 0) {
···
64
65
};
65
66
66
67
struct Roll {
67
67
-
unsigned long row;
68
68
-
unsigned long col;
68
68
+
std::size_t row;
69
69
+
std::size_t col;
69
70
};
70
71
71
72
std::vector<Roll> get_removable_rolls(Matrix &data) {
72
73
std::vector<Roll> rolls{};
73
73
-
for (unsigned long row = 0; row < data.height(); ++row) {
74
74
-
for (unsigned long col = 0; col < data.width(); ++col) {
74
74
+
for (std::size_t row = 0; row < data.height(); ++row) {
75
75
+
for (std::size_t col = 0; col < data.width(); ++col) {
75
76
if (data[row][col] != '@') {
76
77
continue;
77
78
}