I'm having problems with using map in VC++, here is the function that I'm making:
I keep getting the error :"syntex error '[' ", any idea what's wrong?
void GLMesh::convertToDiffCoord(Mesh *m)
//get the pointer to the list of pointers to all vertices
list<Vertex*>* v = m->get_vertices();
//initialize a map that will map each vertex pointer with an unique key
map<int, Vertex*> VMap;
//initialize iterator for the pointer list v
//iterate through the list and map each member in the list with a unique value
for (int i=0; i<v->size(); i++)
for(vi = v->begin(); vi != v->end(); vi++)
VMap[i] = v->[i];
You probably want this:
VMap[i] = v[i];
v is a pointer, and pointers can be treated as array names.
-> breaks out class members; its used for a pointer to a multi-field variable.
 is how you get to a location in an array of the same object.
and you can mix and match, an array of classes might give you
thingy->field = 3;
you can also use * instead of  to make you code uglier, you see this in C code or in c++ code written by C programmers.
By alsoares in forum AJAX
Last Post: 12-20-2007, 08:03 PM
Last Post: 05-16-2007, 04:06 PM
Last Post: 01-29-2006, 12:10 AM
Last Post: 01-28-2006, 08:25 AM
By mark hembree in forum ASP.NET
Last Post: 01-11-2001, 11:21 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center