VS2012 how to show documentation of standard C++ libraries via IntelliSense?
Asked Answered
R

4

16

I started learning C++ a few days ago using Visual Studio 2012. I'm used to programming Java with IntelliJ IDEA and there you always get shown the documentation and expected arguments when calling a method. Is there a way to also do this in VS2012 for C++?

If I understood it correctly this should already be displayed because of IntelliSense but if I for example call a member function of vectors or strings it only shows me something like:

public: std::vector<std::string, std::allocator<std::string>>::const_iterator std::vector<std::string, std::allocator<std::string>>::begin() const

but nothing indicates what is returned, what is expected, what this function does. Am I just missing the documentation files?

Any help is greatly appreciated!

Reneareneau answered 12/4, 2013 at 14:43 Comment(5)
it is telling you what is returned: std::vector<std::string, std::allocator<std::string>>::const_iterator, but you are right, it would be nice if there was more information provided.Percolator
thank you for the information. that already makes it a lot clearer :)Reneareneau
no problem. the intellisense can get really long and convoluted when you are using lots of templated methods, but the return type is always going to be the first part after the access level. there are plenty of sites that can tell you how to use the STL. cppreference.com is one of my favorites. good luck!Percolator
What about the comments regarding what the function does? Anyway to get those?Poly
+1 C# in Visual Studio 2012 does have pretty neat documentation. I don't understand why this feature isn't included in C++...Dour
B
0

IntelliSence showed you the exact type, that was returned. If you want a hint, what to do with this type, try searching at cppreference, it's a very helpful STL resource

Bihari answered 29/5, 2021 at 9:38 Comment(0)
P
0

As far as I know, Vistual Studio doesn't have this function even in version 2019 (haven't try 2022, but I guess it doesn't either). I think there may be 2 reasons for this:

  • C++ is far more complicated than Java. There are so many historical problems. It was not designed with a document comment gramma at first.
  • The standard library is used too frequently that you are supposed to remember its API. There's not so much to rememver, right?

Some IDEs can show you hints when the comments are in Doxygen format. I know C++ plugins for VS Code and Qt Creator do. Maybe Visual Studio can do this too? But Vistual Studio's implementation of STL doesn't use Doxygen.

Also, don't expect to understand what the type name means if you use templates, because there will be some type names like this 🤣:

struct boost::fusion::vector<class boost::spirit::lex::lexertl::iterator<class boost::spirit::lex::lexertl::functor<struct boost::spirit::lex::lexertl::token<class std::_String_iterator<class std::_String_val<struct std::_Simple_types<char> > >,struct boost::mpl::vector<__int64,struct String,struct Symbol,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na>,struct boost::mpl::bool_<1>,unsigned __int64>,class boost::spirit::lex::lexertl::detail::data,class std::_String_iterator<class std::_String_val<struct std::_Simple_types<char> > >,struct boost::mpl::bool_<1>,struct boost::mpl::bool_<1> > > & __ptr64,class boost::spirit::lex::lexertl::iterator<class boost::spirit::lex::lexertl::functor<struct boost::spirit::lex::lexertl::token<class std::_String_iterator<class std::_String_val<struct std::_Simple_types<char> > >,struct boost::mpl::vector<__int64,struct String,struct Symbol,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na>,struct boost::mpl::bool_<1>,unsigned __int64>,class boost::spirit::lex::lexertl::detail::data,class std::_String_iterator<class std::_String_val<struct std::_Simple_types<char> > >,struct boost::mpl::bool_<1>,struct boost::mpl::bool_<1> > > const & __ptr64,class boost::spirit::lex::lexertl::iterator<class boost::spirit::lex::lexertl::functor<struct boost::spirit::lex::lexertl::token<class std::_String_iterator<class std::_String_val<struct std::_Simple_types<char> > >,struct boost::mpl::vector<__int64,struct String,struct Symbol,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na,struct boost::mpl::na>,struct boost::mpl::bool_<1>,unsigned __int64>,class boost::spirit::lex::lexertl::detail::data,class std::_String_iterator<class std::_String_val<struct std::_Simple_types<char> > >,struct boost::mpl::bool_<1>,struct boost::mpl::bool_<1> > > const & __ptr64,struct boost::spirit::info const & __ptr64>
Photochemistry answered 15/8, 2022 at 8:4 Comment(2)
Just notice this question was asked in 2013 😅. Never mind, just leave the answer here. I guess the asker have been a adept in C++ now.Photochemistry
After certain point(it is in 2017, when appeared, I'm not sure), IS understands javadoc\doxigen comment frame (but not tags) and shows thecomment in the tooltip. But that's it. You have to add it yourself, obviously standard and OS headers don't have them.Leatherneck
B
0

As this answer said, in the example you provided Intellisense is providing the full function signature, though it is a little hard to parse visually because of the fully-qualified typename (std::vector<std::string, std::allocator<std::string>>) being prepended to the return value and function name. Here it is, replacing the type with T:

public:
T::const_iterator T::begin() const

There isn't much documentation available directly in Visual Studio, but Microsoft does have good online resources, e.g. VS2015 vector class

Bursa answered 4/4, 2023 at 2:15 Comment(0)
P
-1

Nasty to read through all the templates and std namespace, but the return type is vector<string>::const_iterator.

I've heard Stephan Lavavey (Microsoft maintainter of the STL) mention that he would like better error messages if something doesn't compile. Maybe that will make the intellisense easier to use as well.

Procure answered 13/8, 2013 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.