-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
The original template for addEdge included a default value in the definition which died with an error that you couldn't redefine the template with a default value
template <typename G>
bool BoostGraph_i<G>::addEdge(int nodeIdSource, int nodeIdSink, double weightVal=1.0) {
Pair* twoNodes = new Pair(nodeIdSource,nodeIdSink);
GEdge* thisEdge = new GEdge(twoNodes,weightVal);
addNode(nodeIdSource);
which was already defined on line 66
G* boostGraph;
virtual bool addNode(int nodeId);
virtual bool addEdge(int nodeIdSource, int nodeIdSink, double weightVal);
I changed it to
template <typename G>
bool BoostGraph_i<G>::addEdge(int nodeIdSource, int nodeIdSink, double weightVal) {
if (! weightVal ) weightVal=1.0;
Pair* twoNodes = new Pair(nodeIdSource,nodeIdSink);
GEdge* thisEdge = new GEdge(twoNodes,weightVal);
addNode(nodeIdSource);
I am uncertain whether this is the correct way to assign a default. Need to read some docs to see if it causes errors in test.
What is certain is that this does not permit setting a weight of 0 (but why are you adding an edge if you're not going to use it?)
Metadata
Metadata
Assignees
Labels
No labels