If I have a std::vector
or std::map
variable, and I want to see the contents, it's a big pain to see the nth element while debugging. Is there a plugin, or some trick to making it easier to watch STL container variables while debugging (VS2003/2005/2008)
?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
相关文章
- How to show location of errors, references to memb
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- How to track MongoDB requests from a console appli
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
For vectors, this thread on the msdn forums has a code snippet for setting a watch on a vector index that might help.
You could create a custom visualiser Check this out: http://www.virtualdub.org/blog/pivot/entry.php?id=120
Visual Studio 2008, at least for me, displays the contents of STL containers in the standard mouseover contents box.
Above discussed method [((v)._Myfirst)[index]] will work only for specific container(std::vector) not for all possible STL containers. For example if you want to see the content of std::deque then you have to look for some other method to browse through the content in std::deque.
Maybe you can try the following similar setting to solve your issue
[I tested this setting only for Visual Studio 2010 Professional version installed with Microsoft Visual studio 2010 Service pack 1]
Step 1: Uninstall the Microsoft Visual studio 2010 Service pack 1 - for my project work I don't really need the Service pack 1 so uninstalling service pack 1 will not cause any issue for my case.
Step 2: Restart your system.
Step 3: This step is not necessary if you are not getting Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt'. Otherwise browse through
Project Property -> Linker (General) -> Change Enable Incremental Linking to No (/INCREMENTAL:NO)
In vs 2015, I could not get any of these working
so, i wrote a bit of code
1: I had vector of vector of long long elements
basically what i did was converted vector into string. i had vector of vector so i had string vector to fill.
2: if you have just a vector of long long elements, then just convert as below:
hope it helped.
If you want to watch more than one element at the same time, you can append a comma and the number of elements as so:
(v._Myfirst)[startIndex], count
However, note that count must be a constant, it cannot be the result of another expression.