marci@890: // Use a DIMACS max flow file as stdin.
marci@890: // const_map_time < dimacs_max_flow_file
marci@890: 
marci@890: #include <iostream>
marci@890: 
alpar@921: #include <lemon/maps.h>
alpar@921: #include <lemon/smart_graph.h>
alpar@921: #include <lemon/time_measure.h>
alpar@921: #include <lemon/dimacs.h>
alpar@921: #include <lemon/graph_wrapper.h>
marci@890: 
alpar@921: using namespace lemon;
marci@890: 
marci@890: int main() {
marci@890: 
marci@890:   typedef SmartGraph Graph;
marci@890:   typedef Graph::Node Node;
marci@890:   typedef Graph::Edge Edge;
marci@890:   typedef Graph::EdgeIt EdgeIt;
marci@890: 
marci@890:   Graph g;
marci@890: 
marci@890:   Node s, t;
marci@890:   NullMap<Edge, int> cap;
marci@890:   readDimacs(std::cin, g, cap, s, t);
marci@890:   //typedef ConstMap<Node, Bool<true> > CN1; CN1 cn1;
marci@890:   typedef ConstMap<Node, True> CN1; CN1 cn1;
marci@890:   typedef ConstMap<Node, bool> CN2; CN2 cn2(true);
marci@890:   // typedef ConstMap<Edge, Bool<true> > CE1; CE1 ce1;
marci@890:   typedef ConstMap<Edge, True> CE1; CE1 ce1;
marci@890:   typedef ConstMap<Edge, bool> CE2; CE2 ce2(true);
marci@890:   typedef SubGraphWrapper<Graph, CN1, CE1> SB1; SB1 sb1(g, cn1, ce1);
marci@890:   typedef SubGraphWrapper<Graph, CN2, CE2> SB2; SB2 sb2(g, cn2, ce2);
marci@890:   Timer ts;
marci@890:   cout << "specialized (compile-time) const map time:" << endl;
marci@890:   ts.reset();
marci@890:   for (SB1::NodeIt n(sb1); n!=INVALID; ++n)
marci@890:     for (SB1::EdgeIt e(sb1); e!=INVALID; ++e) { }
marci@890:   cout << ts << endl;
marci@890:   ts.reset();
marci@890:   cout << "generic const map time:" << endl;
marci@890:   for (SB2::NodeIt n(sb2); n!=INVALID; ++n) 
marci@890:     for (SB2::EdgeIt e(sb2); e!=INVALID; ++e) { }
marci@890:   cout << ts << endl;
marci@890:   return 0;
marci@890: }