debug window: watches. show vector<bool> values

Jul 27, 2019 at 5:54pm
hi community when lm trying to show a vector<bool> values in the watches debugger window, it says: side effects are not allowed.

what l put is: myVector.MemberWichStoresFirstValue[startIndex],numberElementsToDisplay

it works for every others vectors like vector<int> and string. Do lm missing something? a casting could solve the problem?

lm using borland builder 6 c++ (this doesnt matter watches window debug has the same syntax than visual studio). Thanks in advance
Last edited on Jul 27, 2019 at 5:57pm
Jul 27, 2019 at 10:35pm
I'm not familiar with borland IDE, and can't use VS right now, but... this could be an issue with how vector<bool> is actually a specialization of vector, where the bools are packed into bits, and this affects the behavior of vector<bool>.

I searched the issue and found this Stack Overflow post: https://stackoverflow.com/questions/104959/inspecting-stl-containers-in-visual-studio-debugging
See also: https://social.msdn.microsoft.com/Forums/vstudio/en-US/e9a00a6a-cfbf-46c8-91a1-334d034db9d9/how-to-watch-each-element-in-a-vector-when-debugging?forum=vcgeneral

StackOverflow wrote:
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.

Does that allow you to watch the values?
Last edited on Jul 27, 2019 at 10:37pm
Jul 28, 2019 at 1:24pm
All those answer they only works with no boolean vector

I already post the syntax Im following
my_Vector.Member_Wich_Stores_FirstValue [startIndex], number_Elements_ToDisplay
its the same form wich the answers say.
Topic archived. No new replies allowed.