Specialized ConstMap for defining constant maps at compile time, by klao.
Time comparision of the generic and specialized maps.
3 #include <hugo/skeletons/path.h>
5 #include <hugo/list_graph.h>
9 using namespace skeleton;
11 template<class Path> void checkCompilePath(Path &P)
13 typedef typename Path::EdgeIt EdgeIt;
14 typedef typename Path::NodeIt NodeIt;
15 typedef typename Path::GraphNode GraphNode;
16 typedef typename Path::GraphEdge GraphEdge;
17 //typedef typename Path::Builder Builder;
18 //??? ha csinalok ilyet es siman Builderrel peldanyositok, akkor warningol. Talan friend miatt? De ki az?
28 //Path(const Graph &_G) {} //the constructor has been already called
30 st=P.length(); //size_t length() const {return 0;}
31 b=P.empty(); //bool empty() const {}
32 P.clear(); //void clear() {}
34 gn=P.head(); //GraphNode/*It*/ head() const {return INVALID;}
35 gn=P.tail(); //GraphNode/*It*/ tail() const {return INVALID;}
37 ei=P.first(ei); //It& first(It &i) const { return i=It(*this); }
39 ni=P.head(ei); //NodeIt head(const EdgeIt& e) const {}
40 ni=P.tail(ei); //NodeIt tail(const EdgeIt& e) const {}
46 EdgeIt i; //EdgeIt() {}
47 EdgeIt j(INVALID); //EdgeIt(Invalid) {}
48 EdgeIt k(p); //EdgeIt(const Path &_p) {}
50 i=++j; //EdgeIt& operator++() {}
51 b=(i==j); //bool operator==(const EdgeIt& e) const {return true;}
52 b=(i!=j); //bool operator!=(const EdgeIt& e) const {return true;}
55 NodeIt l; //NodeIt() {}
56 NodeIt m(INVALID); //NodeIt(Invalid) {}
57 NodeIt n(p); //NodeIt(const Path &_p) {}
59 l=++m; //NodeIt& operator++() {}
60 b=(m==n); //bool operator==(const NodeIt& e) const {}
61 b=(m!=n); //bool operator!=(const NodeIt& e) const {}
63 typename Path::Builder builder(p); //Builder(Path &_P) : P(_P) {}
64 builder.setStartNode(gn); //void setStartNode(const GraphNode &) {}
65 builder.pushFront(ge); //void pushFront(const GraphEdge& e) {}
66 builder.pushBack(ge); //void pushBack(const GraphEdge& e) {}
67 builder.commit(); //void commit() {}
68 builder.reserveFront(st); //void reserveFront(size_t r) {}
69 builder.reserveBack(st); //void reserveBack(size_t r) {}
73 template void checkCompilePath< skeleton::Path<ListGraph> >(skeleton::Path<ListGraph> &);
74 template void checkCompilePath< DirPath<ListGraph> >(DirPath<ListGraph> &);
75 template void checkCompilePath< UndirPath<ListGraph> >(UndirPath<ListGraph> &);