Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4906

Teaching and learning resources • Re: Advent of Code 2024

$
0
0
I suspect the algorithm was made intentionally slow in order to improve the parallel scaling. I wonder how often that technique is used in real applications.
Fido went into a barking frenzy and demanded proof that the algorithm was slow. To prove my point, I downloaded the C++ code from
Here's a better one in more modern C++.

source code
and obtained

Code:

$ g++ -O3 -o lurk07 lurk07.cpplurk07.cpp: In function 'auto getNumbers(std::string_view, char)':lurk07.cpp:18:9: error: 'from_chars' was not declared in this scope   18 |         from_chars(line.data() + strt, line.data() + end, num);      |         ^~~~~~~~~~lurk07.cpp: In function 'std::pair<long unsigned int, long unsigned int> solve(const std::vector<std::basic_string_view<char> >&)':lurk07.cpp:62:9: error: 'from_chars' was not declared in this scope   62 |         from_chars(line.data(), line.data() + colon, val);      |         ^~~~~~~~~~$ g++ --versiong++ (GCC) 13.2.0Copyright (C) 2023 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This led to dinner followed by a nap.
Needs -std=c++23 option

Statistics: Posted by lurk101 — Tue Dec 10, 2024 2:48 pm



Viewing all articles
Browse latest Browse all 4906

Trending Articles