10 ms·
Here are a couple of expertly-written C++17/C++20 repositories: https://github.com/hanickadot/compile-time-regular-expressions https://github.com/hanickadot/co
by artagnon 6y ago
Here are a couple of expertly-written C++17/C++20 repositories:
https://github.com/hanickadot/compile-time-regular-expressions https://github.com/hanickadot/compile-time-regular-expressio...
https://github.com/nlohmann/json https://github.com/nlohmann/json
If you've not written C++ code before, it can take a while to catch up with the latest developments in C++23. Start with C, and learn these, in approximately the specified order:
1. lvalue references.
2. Constructors, destructors, and inheritance.
3. Annotations such as const and noexcept on members.
4. Simple type templates, and value templates.
5. constexpr, std::move, and rvalue references.
6. Type traits and std::enable_if.
7. Concepts.
Once you learn the core language features, learning the various data structures/algorithms in `std` should just be a matter of looking them up in cppreference, and using them over and over again.
Good luck.
- giancarlostoro 6y agoThe JSON library is impressive: https://github.com/nlohmann/json#examples https://github.com/nlohmann/json#examples
- ChuckMcM 6y agoThis is excellent. FWIW I bought and read "C++ Crash Course" by Lospinso. I found that tremendously helpful with his approach of "assuming you really know C [I do], here is C++" and can easily recommend his book for anyone on this path. That said, I like your ordering too. The other confounding factor is that I have also written a lot of Java code (both during the development of the language and afterward for my column in Javaworld) which I really enjoyed, but it too "fixes" some things which James disliked about C++ (and as a long time C programmer I understood quite well). As a learning experience, this journey has been confounding, enlightening, and painful in equal measures :-)
- ncmncm 6y agoPeople who come to C++ from Java frequently bring with them Java Disease. If you find yourself reaching for std::shared_ptr and virtual functions more often than once in a blue moon, you are suffering from Java Disease, and are writing bad code. Anything that seems to be something Java "fixed" is a thing they failed to understand. You will have to unlearn those, along with myriad bad C habits, many of which you don't know you have. It takes sharp observation to catch them.
- ChuckMcM 6y agoOkay, if somewhat harsh :-). As someone with north of 15 programming languages that I consider myself "fluent" in, albeit some latency involved in ones I've not used for a while, I always look for the idiomatic expression of computation. It is the difference between "writing FORTRAN in <x>, and writing an algorithm in <x>." One of main the reasons I posted the question is that I found that design patterns I expected to be there, were not there, or were not idiomatic, and for whatever reason I am reasonably good at figuring out when something is "not quite right." That said, I think it is unfair to characterize the choices of any language designer as either ignorant or wrong. As someone who participated in the design of Java I can assure you that the team "understood" why C++ did what it did. During that development, if there was any confusion, Guy Steele, whose office was three down from mine, would eloquently explain it so that everyone could understand it. That is not to say there weren't different opinions about "better" ways and "worse" ways to do things, Bill Joy was never a big fan of the Java choices and often took the opposing view across from Gosling. The language that Bill was designing was called 'Self' and it embodied his design choices, just as Java embodied Jame's design choices. Me, as a systems guy, could really care less if Boolean was a first class type or just a uint1. I just want to write code that works.
- ncmncm 6y agoI can assure you that anybody who makes members virtual by default does not understand the feature, even if that body is named Steele. What was much worse was copying in wholesale the C crap that C++ had been obliged to adopt to maintain backward compatibility with C, when Java faced no such constraint.
- jeffreygoesto 6y agoI agree with your list. However, I don't find the first library you referenced readable (i.e. https://github.com/hanickadot/compile-time-regular-expressions/blob/main/include/ctre/starts_with_anchor.hpp https://github.com/hanickadot/compile-time-regular-expressio...), and I am a C++ user since the nineties.
- artagnon 6y agoWhat seems to be the problem with CTRE?
- ncmncm 6y agoThat they are regular expressions.
- jeffreygoesto 6y agoExpressing an algorithm at compile time is so very different from runtime when you do it in template metaprogramming. There is so much visual noise (for my personal feeling at least), writing such code is easier than reading and understanding. Nothing wrong with that special case of regular expressions here, more a general observation. constexpr seems to try and step in, but there still is a large codebase around which is hard to maintain and extend. IMHO D and zig show that it can be better to have compile- and runtime-syntax much closer together.
- greysphere 6y agoWelcome to modern c++, where everything is a header file and compile times don't matter.
- cpdean 6y ago:D
- higerordermap 6y agoIt's templates all the way down, until you meet specializations.
- hobby-coder-guy 6y agoI learned C++ almost 20 years ago but haven’t used it since. Has it changed that much since then?
- deleted 6y ago[deleted]
- BearOso 6y agoThey are expertly-written, but I don’t think these header-only libraries are reflective of most C++ projects. There’s too many tricks and templates that make it hard to read and get a big picture of how it works.