Advent of Code 2024 - Using Cppfront #1354
Replies: 2 comments 2 replies
-
@Lathentar The creator of AoC has asked people not to share their personal inputs.
|
Beta Was this translation helpful? Give feedback.
-
2017 was my first year doing it, and I did it in C++. I've done all the other ones since then (and went back and did the two years before that) in Go, mainly for the library and faster cycle time. |
Beta Was this translation helpful? Give feedback.
-
Hello all! I'm not very active on Github, but have been following Cpp2/Cppfront for about a year now and decided to try 2024's Advent of Code using Cpp2 after doing it in Rust the previous few years. I saw at least one other person sharing their repository as well so I thought it might be worth sharing mine and seeing if others also participated.
You can find my solution to all 25 days here: https://github.com/Lathentar/aoc_2024
This was my first time using Cpp2/Cppfront even though I've been following along for most of 2024. I've been working professionally in C++ for nearly 20 years, though I've been limited to using C++17 due to the constraints of my work environment (video games).
I used Visual Studio 2022 but ran into a few difficulties in the initial setup. I found that I needed to use /std:c++latest and set Build ISO C++ 23 Standard Library Modules to Yes to get anything to compile. Once, I got through that however the experience was pretty great outside of fighting the IDE a bit with the unrecognized syntax. I set up a simple one cpp2 file project that was a template I could copy for each day with some simple code to read in the passed in filename to be parsed.
After just a couple of days I started to feel much more comfortable with the new syntax and started to use the metafunctions (wonderful!), primarily @value and @enum (love it), as well as some C++ functionality I haven't used professionally such as the ranges and views APIs. I did miss having access to switch statements, but I see there is something called inspect (I guess it's just not documented yet). Additionally, I ran into a few annoyances where the last time an object was used it would be compiles to std::move( object ) even though it was being passed into a function that expected it to be in the inout format. This causes some compile errors where I worked around it by doing a _ = object on the next line.
Overall, there is potentially a wonderful future here for C++ with Cpp2 and I look forward to it developing further. I will want to spend some time with future releases building more complex programs with multiple files and trying out Visual Studio Code to see if that development environment is more friendly. If many of the above frictions were significantly improved with a 1.0.0 release, I would strongly consider using this professionally.
Thank you for all the great work all of you have done in this community!
Beta Was this translation helpful? Give feedback.
All reactions