Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
pystring
C++ functions matching the interface and behavior of python string methods with std::string
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
I tend to use std::getline to read each line into a string and then a regular expression to break out the line. Where ‘regular expression’ is CTRE from https://github.com/hanickadot/compile-time-regular-expressions
After that, I use this rather excellent library 😉 or CTRE if the input format is more complicated.
If you are used to python strings give pystring from Sony Imageworks a go. https://github.com/imageworks/pystring
Here is my solution to today's problem, for example.
re: advent of code, I've been doing it this year in modern style C++, actually C++23 because I use ranges::to and ranges::views::zip.
std::ranges is in c++20, but you can pull in the library it was based on if you use 17 (https://github.com/ericniebler/range-v3)
You want to: 1) checkout strutil: https://github.com/tgalaj/strutil (I used that for my 2022's AoC in C++ a lot) (also eigen: https://eigen.tuxfamily.org/index.php?title=Main_Page and tensorx: https://tensorx.org/ might not hurt) 2) checkout and compare with other people's code: https://github.com/Bogdanp/awesome-advent-of-code#c-2
lexy (https://lexy.foonathan.net/)
scnlib (https://github.com/eliaskosunen/scnlib) scanf
I am doing aoc this year in modern C++, here is the Github link in case you want to take a look to learn or give some feedback https://github.com/GGCristo/aoc2023