WHY
IS
EVERY
GODDAMN
EXAMPLE CODE
ON CPPREFERENCE.COM
SO
FUCKING
CONVOLUTED
AND
ASS BACKWARDS
AND NON EXPLANATORY
AND NONSENSICAL
HOW
THE
FUCK
AM
I
SUPPOSED
TO
LEARN
WITH
SUCH
HORRIBLE
EXAMPLES
THAT
DON'T
EVEN
MAKE
THE
SLIGHTEST
BIT
OF
FUCKING
SENSE
AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>Try "C".
You're welcome.
Thats the entire C++ language though.
Rust doesn't have this problem.
Shovel away all the steaming C++ shit pile and you have "C". So, yes.
Welcome to C++. I dont even bother reading compiler errors anymore, I only check which line has problem and figure out what's wrong myself.
Tip: The spacebar is the long key on the bottom, not the one on the right with the bent arrow. Also capslock is not intended to be engaged at all times.
I think most examples on cppreference are very concise and straight to the point (unlike any video tutorial or blog post ever)
Rust is even more convoluted.
I'm sorry that the contributors of cppreference don't write over-personalized blog posts while drinking latte in Starbucks or hanging out in a gay bar, but this isn't JavaScript.
this
ARE YOU FUCKING KIDDIN GME DUDE
WHAT THE FUCK IS WRONG WITH YOU SERIOUSLY
This is an example for std::any
#include
#include
int main()
{
std::cout
How about a fucking lambda example?
class S {
int x = 0;
void f() {
int i = 0;
auto l1 = [=]{ use(i, x); }; // captures a copy of i and a copy of the this pointer
i = 1; x = 1; l1(); // calls use(0,1), as if i by copy and x by reference
auto l2 = [i, this]{ use(i, x); }; // same as above, made explicit
i = 2; x = 2; l2(); // calls use(1,2), as if i by copy and x by reference
auto l3 = [&]{ use(i, x); }; // captures i by reference and a copy of the this pointer
i = 3; x = 2; l3(); // calls use(3,2), as if i and x are both by reference
auto l4 = [i, *this]{ use(i, x); }; // makes a copy of *this, including a copy of x
i = 4; x = 4; l4(); // calls use(3,2), as if i and x are both by copy
}
};
It's like they're trying to torture people on purpose
Keep seething brainlet
Seethe harder
You could literally make an example for std::any in two lines of very clear code
It's almost like C++ programmers like being tortured
Get a textbook most references on the internet are trash by themselves
recommendations?
Okay. Write it then.
auto a = std::any(123);
std::cout
i think the general consensus of c++ devs before was "if its hard to write, it should be hard to read" which explains a lot of the convoluted stuff. now most of the c++ devs/thought leaders are advocating simplicity cause its now trendy to be "simple" for whatever that means.
It's almost as if the example in cppreference was meant to show how std:any works with different data types
False. The standard library is well documented and each little function has a [src] button which jumps you to the actual implementation since there's actually an official distribution.
Okay let see
cppreference example
>shows how to declare a std::any
>shows how to assign values of different data types
>shows how to cast to a specific data type for printing
>shows what happens if you try to cast it to the wrong type
>shows that the class has its own methods and shows an example of how to use 2 of them
>shows hot to use a std::any with oldschool pointers
Your example
>prints an std::any
I don't see what's wrong with either of those.
I don't know c++ at all so if I can work out what it does then the problem isn't the examples. Maybe this could have been written simpler but I can work out what its doing.
Maybe you need a break for a day or you should probably stick to python.
>he isn't using based cplusplus.com
not gonna make it
Not sure what the Jow Forums recommendation is but I used pic for my c++ class
It's straight forward just do exercises along with it
That site is trash too
Trying to learn programming without reading textbooks or taking classes is a meme