[Lemon-user] use of graph in class
Alpar Juttner
alpar at cs.elte.hu
Sat Nov 2 07:00:29 CET 2013
Hi,
> 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);
> };
There is nothing LEMON specific here. If you want to pass parameters to
a constructor of a class member, you must do it in the constructor of
the main class. It is done in the following way:
class myclass {
SmartGraph g;
SmartGraph::NodeMap<int> m;
public:
myclass() : m(g) {}
};
Regards,
Alpar
More information about the Lemon-user
mailing list