Then we've got a "member function" where magically if we specify a function while midway through specifying a data structure the function is somehow treated as though it were part of that data structure - but of course it is actually just sugar. I know this confuses real learners.
And sure, the lambda syntax is awful but that's sort of par for the course by the time you reach it.
I'm not seeing this - can you clarify?
>Then we've got a "member function" where magically if we specify a function while midway through specifying a data structure the function is somehow treated as though it were part of that data structure - but of course it is actually just sugar. I know this confuses real learners.
Humor me, show me where this "member function" is?
I honestly feel like we're not reading the same code .. but maybe that's your point.
#include is a C pre-processor feature which just pastes in whatever the contents of the specified file are. Did you not know that's what it does ?
> Humor me, show me where this "member function" is?
That doAsyncOperation is a member function. Unlike member variables, which are part of the actual data structure we're defining, the member functions are the peculiar syntax for methods in C++, the function won't actually live inside the data structure, we're not making any sort of function pointer or reference - it's just written here because presumably Bjarne couldn't think of anywhere better to put it.
I guess it's possible you didn't understand that, it does seem like a fair number of undergrads think this will be how it works when shown C++ which isn't great news.
> I honestly feel like we're not reading the same code .. but maybe that's your point.
I'm reading the code you wrote in https://news.ycombinator.com/item?id=45484503 and frankly the response just makes me think C++ programmers don't understand C++ either.
LOL, I’ve been writing professional C and C++ code for 40 years, so yes indeed I know perfectly well what it does, I just couldn’t fathom your description as being a valid complaint. I mean, seriously?
“Data structure”. No, it’s a class.
Since this class is about encapsulating behavior, managing state, or providing an interface it’s better described as a code module.
Since you cannot make this distinction and seem more inclined to argue from the position of someone who can’t/won’t write C++ code, I’ll just leave you to your misery and state that I disagree with your whining, completely. Please don’t ever write any C++.