That's what I wanted.
2 #ifndef FOR_EACH_MACROS_H
3 #define FOR_EACH_MACROS_H
7 #define FOR_EACH_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
8 #define FOR_EACH_INC_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
10 #define FOR_EACH_EDGE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
11 #define FOR_EACH_NODE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
12 #define FOR_EACH_INEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
13 #define FOR_EACH_OUTEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
15 // template<typename It, typename Graph>
16 // It loopFirst(const Graph& g) const {
17 // It e; g.first(e); return e;
20 // template<typename It, typename Graph>
21 // It loopFirst(const Graph& g, const Node& v) const {
22 // It e; g.first(e, v); return e;
25 // template<typename Graph>
26 // typename Graph::NodeIt loopFirstNode(const Graph& g) const {
27 // typename Graph::NodeIt e; g.first(e); return e;
29 // template<typename Graph>
30 // typename Graph::EdgeIt loopFirstEdge(const Graph& g) const {
31 // typename Graph::EdgeIt e; g.first(e); return e;
33 // template<typename Graph>
34 // typename Graph::OutEdgeIt
35 // loopFirstOutEdge(const Graph& g, const Node& n) const {
36 // typename Graph::OutEdgeIt e; g.first(e, n); return e;
38 // template<typename Graph>
39 // typename Graph::InEdgeIt
40 // loopFirstIn Edge(const Graph& g, const Node& n) const {
41 // typename Graph::InEdgeIt e; g.first(e, n); return e;
44 //FIXME ezt hogy a gorcsbe birja levezetni. Csak ugy leveszi a const-ot??
45 template<typename It, typename Graph>
46 It loopFirst(const It&, const Graph& g) {
47 It e; g.first(e); return e;
50 template<typename It, typename Graph, typename Node>
51 It loopFirst(const It&, const Graph& g, const Node& v) {
52 It e; g.first(e, v); return e;
55 // template<typename Graph>
56 // typename Graph::NodeIt loopFirstNode(const Graph& g) const {
57 // typename Graph::NodeIt e; g.first(e); return e;
59 // template<typename Graph>
60 // typename Graph::EdgeIt loopFirstEdge(const Graph& g) const {
61 // typename Graph::EdgeIt e; g.first(e); return e;
63 // template<typename Graph>
64 // typename Graph::OutEdgeIt
65 // loopFirstOutEdge(const Graph& g, const Node& n) const {
66 // typename Graph::OutEdgeIt e; g.first(e, n); return e;
68 // template<typename Graph>
69 // typename Graph::InEdgeIt
70 // loopFirstIn Edge(const Graph& g, const Node& n) const {
71 // typename Graph::InEdgeIt e; g.first(e, n); return e;
74 #define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
75 #define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
77 // #define FOR_EACH_EDGE_LOC(e, g) ezt nem tom hogy kell for((g).first((e)); (g).valid((e)); (g).next((e)))
78 // #define FOR_EACH_NODE_LOC(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
79 // #define FOR_EACH_INEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
80 // #define FOR_EACH_OUTEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
85 #endif //FOR_EACH_MACROS_H