visual studio 2012 - Scoping issue with redefined variable in c++ -


given following code:

for (list<vertex*>::iterator v = vertexlist->begin(); v != vertexlist->end(); v++) {     if (!(*(*v) == *u))     {         (*v)->setcolor(white);         (*v)->setpred(null);         (*v)->setdist(infinity);     } }  queue<vertex*> q; q.push(u); vertex* v = q.front();  // wont assign item in queue v vertex* t = q.front();        // assign item in queue t 

as can see variable v has been defined in loop , (at least far know) should last in scope. (while active).

but, when i'm trying assign q front new variable named v, wont put item in queue inside. instead, see ?????? inside it. (using visual studio 2012). compilation passes.

in other hand, when try assign q front variable not named v let me , t hold correct value (the first item in queue).

what missing here..?

i think debugger bug, if there descriptive property or member of vertex, can write in console control , see vertex* v correctly assigned.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -