Is there any way to rename the first and second accessor functions of a map iterator. I understand they have these names because of the underlying pair which represents the key and value, but I'd like the iterators to be a little more readable. I think this might be possible using an iterator adaptor, but I'm not sure how to implement it.
Please note that I can't use boost.
Example of what I mean:
map<Vertex, Edge> adjacency_list;
for(map<Vertex, Edge>::iterator it = adjacency_list.begin();
it != adjacency_list.end();
++it)
{
Vertex v = it->first;
//instead I would like to have it->vertex
}
See Question&Answers more detail:os