User Profile
Collapse
-
Any other ideas, before I create my own custom iterator? -
By the way, just to clarify, I'm not just concerned with changes to the list. I am also trying to avoid changes to the objects that are pointed to by the pointers in the list.Leave a comment:
-
I have considered that, but each node already has a list of Edge pointers, and I am trying to avoid having to copy all the data into a new list. I was also trying to eliminate returning a copy of the list, since this occurs in code that is performance critical.
Also, there are other places in the code with similar problems. For example, consider two classes Base and Derived, where Derived inherits Base. There are places in the code...Leave a comment:
-
Need efficient way of converting list<A*> to list<const A*>
I am working with a specialized graph class, which has a node class and an edge class. In the node class, there is a list of pointers to each edge. Code that uses the graph must be able to see what edges are contained in a node. This is handled by returning a const reference to a list of edge pointers, i.e:
Code:const list<Edge*>& Node::getEdges() const { return edges; // list<Edge*> }
No activity results to display
Show More
Leave a comment: