r/cpp • • Dec 15 '21

Modern C++ in Advent of Code

This series, by Šimon Tóth, is a step by step guide through the solutions of Advent of Code 2021 using Modern C++.

242 Upvotes

83 comments sorted by

View all comments

31

u/Ecclestoned Dec 15 '21

Seeing these gives me no desire to use c++. Most of the challenges are 10-20 lines in Python. Meanwhile the c++ code starts with "first let's define an implementation for a tuple, it's constructor, comparison operator, and make it hashable". Yikes.

1

u/vsdmars Dec 15 '21

agree on the. '10-20 lines in Python' part.

Python is great for interview/leetcoding; while C++/Rust is for real business that look for performance.

We can always layout the algorithm in Python; analyze the runtime complexity; and port it to C++. :-)

1

u/TinBryn Dec 16 '21

While Python is faster for prototyping than C++ I don't think it is that significant. I'm doing AoC in Rust this year and while there are things that slow me down, I still find the significant portion of my delay is from my own understanding of the problem and finding a solution.