2

I just started to learn C++ this month.

In Python, I can view the documentation of a built-in function (for example, str.find) by using help(str.find).

However, I've no idea about how to view the documentation of std::find in <algorithm>, for example.

Does anyone have ideas about a quick way to look up documentation of a function in C++?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Hanfei Sun
  • 45,281
  • 39
  • 129
  • 237

3 Answers3

7

C++ doesn't have built-in documentation like Python.

The most comprehensive online reference guide is C++ reference, which covers the last three standards. This is not the top hit on most search engines but the top hit is full of inaccuracies and should be avoided.

You can also download archives of the site for offline viewing (English link).

Does anyone have ideas about a quick way to look up documentation of a function in C++?

In Google Chrome, I have a search engine set up with the keyword "cpp" and the URL "http://en.cppreference.com/mwiki/index.php?title=Special%3ASearch&search=%s" so that I can type cpp std::find in the address bar to find details of std::find in my browser.

johnsyweb
  • 136,902
  • 23
  • 188
  • 247
3

C++ itself doesn't have "built-in documentation" per se. It is a language, not a system. Sure, Python is "just a language" too, but it's also an interpreter and this interpreter has certain features that C++ compilers don't have.

On Linux you may find manpages for what you need, because libstdc++ (GCC's C++ standard library implementation) installs them:

man std::string

C++ documentation may be found canonically at:

You should not use:

  • Wikipedia
  • SGI STL documentation (the SGI STL is not the same as the C++ Standard Library)
  • http:// cplusplus.com
Community
  • 1
  • 1
Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
  • 1
    To be fair, cplusplus.com has been improving too (perhaps thanks to the competition from cppreference), and is quick to react to error reports (even minute ones, like 'you said unspecified where it says undefined') – Cubbi Apr 18 '13 at 21:37
1

There is no such thing as builtin documentation in C++. You may have some documentation that comes with you compiler, but that is mainly for commercial products and vendor specific. You are best off using google to find your site of choice.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Thomas
  • 4,980
  • 2
  • 15
  • 30