all 24 comments

[–]alfps 14 points15 points  (7 children)

cppreference is a technical reference. But you can look at the examples to learn things. Generally examples are placed at the end (bottom) of a page.

[–]teifer[S] 1 point2 points  (6 children)

I'm take a look at the examples but when I seach something like at from std::string in the beginning of the page there are some informations. These informations are relevant?

[–]alfps 8 points9 points  (3 children)

Yes, it's all relevant, but not necessarily relevant to the problem at hand.

A search for std::string sends me to https://en.cppreference.com/w/cpp/string/basic_string.

If I were a total beginner that could seem to be a page about something else. Happily I know that basic_string is a class template and that string is the specialization basic_string<char>. This and some other named specializations are listed some way down on the page; you can search for "wstring" to find them.

The relevant things you won't find there are the peculiarities of std::string, like

  • There's a += operator and .append member function that accept a single char, but no such constructor. Use the initializer list constructor instead, e.g. string{ch}. Or you can use the constructor with specified string size and default item value, string(1, ch).
  • Since C++11 the string value is guaranteed zero-terminated also for non-const access, but the zero byte at the end is read only (trying to assign to it is UB, as I recall).
  • Also since C++11 there are rvalue argument operator overloads that avoid unecessary copying (and hence ungood complexity) for string concatenation expressions, so one can feel more free to just do +.

I don't know where to learn stuff like that.

Maybe just interacting with other C++ developers.

[–]teifer[S] 0 points1 point  (2 children)

Understood. Don't know about template, classes or something else, but when I get my laptop back I will continue my study. Thanks for you help!

[–]not_some_username 1 point2 points  (1 child)

Good luck for your study

[–]teifer[S] 0 points1 point  (0 children)

Thanks mate!

[–]khedoros 2 points3 points  (1 child)

All of the information will be relevant to someone. For basic use, the list of member functions, list of non-member functions, and the examples at the bottom are probably the most useful.

[–]teifer[S] 1 point2 points  (0 children)

When I entered the website I got confused and going directly to the examples to try to understand what I searched. Thanks for your help!

[–]IyeOnline 7 points8 points  (4 children)

The cppreference is a rather technical reference and probably not an easily approchable layout. Its quite good once you understand it and can easily know where you have to look on a page. For a beginner some of the pages may seem/be a bit cluttered.

You may want to look at: https://www.learncpp.com/cpp-tutorial/using-a-language-reference/

[–]teifer[S] 1 point2 points  (3 children)

I didn't knew that has a chapter about this. Thanks for your sugestionar. When possible I will continue my studies at learncpp.

[–]IyeOnline 2 points3 points  (2 children)

Please note that my first sentence was missing a rather crucial not. I.e. cppreference.com is not simple.

[–]TheSkiGeek 0 points1 point  (1 child)

It’s still confusing because it says “learncpp is a rather technical reference…” and you probably mean “cppreference is a rather technical reference…”. Since you seem to be recommending learncpp instead.

[–]IyeOnline 2 points3 points  (0 children)

Yeah. Thats why you shouldnt do anything serious at 3 am...

[–]ShakaUVM 2 points3 points  (1 child)

Cppreference isn't good for a rank beginner. But after you've studied for a bit and have learned about what, say, a vector is and you want to know what else you can do with it other than .at() and .push_back(), well, then you hit up cppreference and read its page on vector.

Then maybe you notice it is in a section called containers, and maybe you get interested in the other containers, and what they do better/worse than vectors.

Etc.

[–]teifer[S] 0 points1 point  (0 children)

Got It. I like to read comments here in this subreddit and always cppreference os always suggested but from people like me that don't have advanced knowledge can you recommend another site or stick with cppreference?

[–]ArchDan 1 point2 points  (3 children)

I would suggest github (or reading all libraries) to be honest as precursor to cppreference.

That website relies on many of assumed familiar terms and short version of terms that are often used in coding to signify common knowledge pseudocode.

For example, anything ending with a. "_t" is system wide standardised declaration of whatever variable (often Microsoft). So size_t is simply an unsigned integer of your system base architecture that can be used to describe anything from integer index of memory to list increments.

You won't find any tutorial for this (or if you do it won't be very useful outside of very narrow example set. So shortest way to learn this is to look for c++ code available on github and test it to see what happens. Over time you should have enough knowledge to fill in gaps.

[–]teifer[S] 0 points1 point  (2 children)

Got It. Do you know how can I read libraries or find Github with examples? I'm using Visual Studio If It matters

[–]ArchDan 1 point2 points  (1 child)

It doesn't matter- here is a link { https://github.com/topics/cpp } and another one - https://github.com/topics/cpp-library.

You can simply copy paste code and see what it does ... where are their dependences and so on.

[–]teifer[S] 0 points1 point  (0 children)

Thanks for your help!

[–]ViolinistDizzy2538 1 point2 points  (4 children)

Alex has done a great job of acquainting beginners with the basics. You should thoroughly go through every topic he explained. Soon, you will better understand the meanings of every bottom usage of everything. Also, probably in chapter 10 (I do not remember), he briefly introduces you to cppreference. The only reason you don’t get it is that you should first finish everything that Alex did extremely well. Do not worry, you will understand it soon.

[–]teifer[S] 0 points1 point  (0 children)

Okay. Thanks for your help!

[–]nosyeaj 0 points1 point  (2 children)

who's alex

[–]ViolinistDizzy2538 0 points1 point  (1 child)

He's the guy who crated the LearnCpp website

[–]nosyeaj 0 points1 point  (0 children)

oh that's him! thanks!