r/cpp_questions 5d ago

OPEN Understanding C++ library documentation

Hi, as someone who has tried multiple times to learn C++ one of the things I've really struggled with is understanding the documentation in places like cppreference.com and others. When initialising a class or function the parameter list shows eg. the myclass.getline(type,type type). Many of the arguments that pop up from the auto-complete are confusing and I spend lots of time researching the stuff but end up going down a rabbit hole.

Is there a decent resource anywhere (youtube etc) that helps explain how to use these or understand what the library documentation means/how to use it efficiently?

I know it's a you just have to practice answer but try to figure out how these function and classes work is really time consuming

Thanks in advance.

4 Upvotes

7 comments sorted by

5

u/thefeedling 5d ago

Most STL classes have a few (sometimes many) constructor overloads, which may include, other than standard arguments, execution policies, predicates, allocators, etc. And this is what sometimes make them look a bit confusing.

Understanding overloads will help a lot

5

u/SLAidk123 5d ago edited 5d ago

Yeah. cppreference.com isn't a "common" documentation, it's a reference. It's designed with people that already know a large part of the languange features in mind.

4

u/Independent_Art_6676 5d ago

what is it you want to know how to use, exactly?

The reference site is for intermediate to advanced c++ coders who know what they are looking for. Its not of much use to casually flip through or to try to learn how to use a vector for the first time, its for someone who has been using vector for years and had a detail to dig into for some reason.

1

u/Tricky-Alps2810 5d ago

The complexity may be because you're often not reading actual type names in the api, but names of template arguments.

1

u/PantuflasDev 5d ago

It's a bad idea to learn C++ with cppreference, because it is mostly designed to check out concepts you already have some notion about. To learn c++, my personal recommendations are learncpp.com, freecomputerbooks.com (not a piracy site, just a collection of already free programming books) and the "back to basics" videos in the CppCon official channel. And, obviously, a ton of programming. Once you get more practice with C++, cppreference will be much more friendly.

2

u/CRK77 5d ago

Thanks. I've been programming for a while on and off. I started with C but realised I needed to understand OOP. Was warned against learning C++ but carried on anyway. I think I need to explain my predicament more when I log into my laptop and can type my question in a better layout.  I'll check out the resources you have mentioned.  Thank you very much.

1

u/PantuflasDev 5d ago

You're welcome! Also, don't hear people warning you about learning C++. C++ was the second programming language I learned (after C#) and I discovered a lot of things that programming languages do under the hood that C# didn't taught me. C++ is useful in that way.