visual c++ debug dinamic objects

G

gp

Hi all,

I'm using Microsoft Visual C++ 6.0,
I would like to see, debugging my project, all the elements of my dinamic
objects....

I have a dinamic array and a STL vector and I need to know the fields values
at a specific position, but in the Watch windows I can only see the first
element...

I tried putting in the watch window
vector_name
vector_name[k]
vector_name[5]
vector_name.at(k)
vector_name.at(5)
vector_name[5].field_name
....
etc....

but there's no way...

could anyone help me?
thanks...
 
M

mlimber

gp said:
Hi all,

I'm using Microsoft Visual C++ 6.0,
I would like to see, debugging my project, all the elements of my dinamic
objects....

I have a dinamic array and a STL vector and I need to know the fields values
at a specific position, but in the Watch windows I can only see the first
element...

I tried putting in the watch window
vector_name
vector_name[k]
vector_name[5]
vector_name.at(k)
vector_name.at(5)
vector_name[5].field_name
...
etc....

but there's no way...

could anyone help me?
thanks...

You'll have to dig into the implementation of their std::vector, but I
think it should be something like this:

*(vector_name._First+k)

Cheers! --M
 
A

Anand

gp said:
Hi all,

I'm using Microsoft Visual C++ 6.0,
I would like to see, debugging my project, all the elements of my dinamic
objects....

I have a dinamic array and a STL vector and I need to know the fields values
at a specific position, but in the Watch windows I can only see the first
element...

I tried putting in the watch window
vector_name
vector_name[k]
vector_name[5]
vector_name.at(k)
vector_name.at(5)
vector_name[5].field_name
...
etc....

but there's no way...

could anyone help me?
thanks...

<OT newgroups-to-try-in="*microsoft.vc*">
http://www.codeguru.com/Cpp/V-S/tips/article.php/c465/
</OT>
 
?

=?ISO-8859-1?Q?Stefan_N=E4we?=

mlimber said:
gp said:
Hi all,

I'm using Microsoft Visual C++ 6.0,
I would like to see, debugging my project, all the elements of my dinamic
objects....

I have a dinamic array and a STL vector and I need to know the fields values
at a specific position, but in the Watch windows I can only see the first
element...

I tried putting in the watch window
vector_name
vector_name[k]
vector_name[5]
vector_name.at(k)
vector_name.at(5)
vector_name[5].field_name
...
etc....

but there's no way...

could anyone help me?
thanks...


You'll have to dig into the implementation of their std::vector, but I
think it should be something like this:

*(vector_name._First+k)

OT, but try:

(vector_name)._First,N

where N is the number of elements you think exist in 'vector_name'
(and yes, it is a comma)

/S.
 
G

gp

thanks!
(vector_name)._First,N works well with vectors!

do you know how can make the same thing with a dinamic classic array?
(i have a function which takes as parameter "array[]" and I would like to
know every array element...)




Stefan Näwe said:
mlimber said:
gp said:
Hi all,

I'm using Microsoft Visual C++ 6.0,
I would like to see, debugging my project, all the elements of my dinamic
objects....

I have a dinamic array and a STL vector and I need to know the fields
values
at a specific position, but in the Watch windows I can only see the first
element...

I tried putting in the watch window
vector_name
vector_name[k]
vector_name[5]
vector_name.at(k)
vector_name.at(5)
vector_name[5].field_name
...
etc....

but there's no way...

could anyone help me?
thanks...


You'll have to dig into the implementation of their std::vector, but I
think it should be something like this:

*(vector_name._First+k)

OT, but try:

(vector_name)._First,N

where N is the number of elements you think exist in 'vector_name'
(and yes, it is a comma)

/S.
 
M

mlimber

gp said:
thanks!
(vector_name)._First,N works well with vectors!

do you know how can make the same thing with a dinamic classic array?
(i have a function which takes as parameter "array[]" and I would like to
know every array element...)

array[5]
*(array+5)

Both should work. The trick here is that for std::vector, the []
operator is actually an implicit function call. For "classic" arrays,
the [] operator should work as usual in any debugger worth its salt.

Cheers! --M
 
J

John Harrison

gp said:
thanks!
(vector_name)._First,N works well with vectors!

do you know how can make the same thing with a dinamic classic array?
(i have a function which takes as parameter "array[]" and I would like to
know every array element...)

It's the same trick

array,N

The comma is the key.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top