VertexInfo(n1index, n2index)creates a temporary object VertexInfo. Temporary cannot be attached to a non-constant link.
Changing your function addVertexInfo()to get a reference to const will help fix this problem:
void addVertexInfo(const VertexInfo& vi) { }
In general, if a function does not change the argument that it takes by reference, it must accept a constant reference.
source
share