简体   繁体   中英

How to see in Xcode using c++ std::vector elements types and values?

in visual studio when i used to debug code with c++ std::vector i could see all the elements in it and even drill down to each element , somehow in Xcode 5.1 i can see this option
all i see is the iterators of the vector.

here is what i see in Xcode when i try to watch vector elements : 的std ::矢量 how can i see the vectors elements in the debug window .

For me (Xcode 6.0.1), this happens only with reference (&) types.

Try one of the following:

  1. Add a custom watch expression *&strLineOfChrsVec (dereference the address of the variable).
  2. Go up the stack and watch the original variable that you've passed to the function.

In order to temporarily see the values of a single element in the vector you can right click on it and then select:

Print Description of "[i]"

It will print to the output something like:

Printing description of *([1]): (std::__1::basic_string, std::__1::allocator >) [1] = "Hi"

where "Hi" was the value of the vector at position 1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM