[Lemon-user] use of graph in class

Jaap Kroes jaap.kroes at epfl.ch
Fri Nov 1 22:48:33 CET 2013


Dear developers/users,

I am starting to learn how to use the lemon library and ran into some
unexpected behavior. While the following code compiles fine

#include <lemon/smart_graph.h>
using namespace lemon;
int main() {
  SmartGraph g;
  SmartGraph::NodeMap<int> m(g);
}

The code below does not compile, because I've put these functions in a class
( error: ‘g’ is not a type )

#include <lemon/smart_graph.h>
using namespace lemon;
class myclass {
  SmartGraph g;
  SmartGraph::NodeMap<int> m(g);
};
int main() {
  return 0;
}

It will compile however if I specify the type, but I am not sure if this
gives the expected behavior. I would expect a instance of NodeMap to access
the nodes from a fixed graph.

#include <lemon/smart_graph.h>
using namespace lemon;
class myclass {
  SmartGraph g;
  SmartGraph::NodeMap<int> m(SmartGraph);
};
int main() {
  return 0;
}


Is this the expected behavior and correct way to use a NodeMap inside a
class?

I am using g++ (GCC) 4.8.2, and the latest lemon build (1.3).


Thanks.

Best,
Jaap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20131101/260278b4/attachment.html>


More information about the Lemon-user mailing list