96 karma · joined July 5, 2022
I've recently had the thought that there is an incredibly popular "AI" that is
1) Treated within universe as non-intelligent
2) Incredibly talented at understanding language and translating it directly into commands
3) Often compared unfavourably to actually intelligent AI
LLMs are the star-trek shipboard computer.
The language also seems to be built for the kind of people who think C has no downsides and everyone should write everything as explicitly as possible, which are an audience that normally doesn't get aimed at.
An easy example is ranged-for. It depends on so much complexity internally that the end-user basically will never see. All they'll see is that as long as std::begin and std::end are defined for a container you can just `for (auto item : container)` it. Stuff like overload resolution is essential to it but you don't need to know overload resolution rules to use ranged-for.
Or the way initializer lists make initialization so much simpler. The way you can leave constructor writing to the compiler for so many different types of constructors.
How the compiler handles elision so well because of how the constructors are designed. You don't need to write a single rvalue reference move constructor for simple types. They're generated for you.
The current ongoing push to make large parts of the standard library constexpr so you can have seriously complex things going on directly at compile time to result in a minimal output that can just put in equivalent constants to constexpr function calls.
Like, the reality is, it is pretty much a core principle of the language that you can write C++2003 if you really want to, and everything on top of it just makes writing things easier. But if you want to piecewise substitute your code with the latest stuff it more often than not becomes terser and more straightforward because of the evolution of the std library.
e^(i * pi) + 1 = 0
It's considered incredibly elegant because it manages to combine multiple fundamental mathematical concepts into a single equation.
1 is the multiplicative identity, 0 is the additive identity, pi is the circle constant, e is euler's number, i is the square root of -1, the basic building block of complex numbers.
maybe "better-documented"?
There's a series of talks called Back to Basics that seems to have quite a few talks every year where they discuss C++ features in general like move semantics or how testing works, etc. There have also been talks from the creators of CMake or the guys working on the recently added ranges proposal, so it does cover tooling as well.
I also quite enjoy following Jason Turner's C++ weekly series (https://www.youtube.com/@cppweekly) which also has quite a few episodes that are dedicated to new C++ features or new ways of handling old problems made available by the new features. They're generally quite short, each episode on average is 12 minutes.
Just looking down the list of videos I see this is also kind of a direct response to your question, from only 8 months ago. https://youtu.be/VpqwCDSfgz0 [ C++ Weekly - Ep 348 - A Modern C++ Quick Start Tutorial - 90 Topics in 20 Minutes ]
For experimenting:
https://gcc.godbolt.org/ is a tool called compiler explorer, which is a really good place to experiment with toy code.
It's a site where you can write some code and let it execute, to see the results, as well as see what ASM it compiles down to for various compilers.
That last feature really helped me figure out whether the compiler really does pick up an optimisation I'm trying out. (and it's how I got really impressed by how powerful constexpr is (that's one of the new keywords))
For References:
Generally the https://en.cppreference.com site is a really well maintained wiki that has good explanations of every concept and standard library feature.
It sticks to the standard and has use examples and is heavily interlinked, as well as some concept pages to give an overview of certain topics like overloading, templates, etc. (they also have a SFINAE article https://en.cppreference.com/w/cpp/language/sfinae)
Though I can't speculate on how the sci-hub case will actually go since the main reason copying was allowed for students according to the arguments was that before photocopiers existed, they were expected to copy the things themselves.
https://www.thehindu.com/news/cities/Delhi/University-copyin...
Wiki article because the hindu is paywalled: https://en.wikipedia.org/wiki/University_of_Oxford_v._Ramesh...
https://databasearchitects.blogspot.com/2021/06/what-every-p...
Training AI without permission is sneaking a camera into an art gallery without permission.
using namespace std;
using foo_bar_xref = vector<unordered_map<string, pair<string, string>>;
foo_bar_xref foo( vector<vector<int>> x, unordered_map<string, string> y);