Changeset 711:b6c56353832c in lemon-0.x for src/benchmark/hcube.cc
- Timestamp:
- 07/20/04 11:50:11 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@963
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/benchmark/hcube.cc
r708 r711 7 7 #include<hugo/time_measure.h> 8 8 #include<iostream> 9 #include<../work/jacint/max_flow.h> 9 //#include<../work/jacint/max_flow.h> 10 #include"bench_tools.h" 10 11 11 12 using namespace std; 12 13 using namespace hugo; 13 14 ///An experimental typedef factory15 #define GRAPH_TYPEDEF_FACTORY(Graph) \16 typedef typename Graph:: Node Node;\17 typedef typename Graph:: NodeIt NodeIn;\18 typedef typename Graph:: Edge Edge;\19 typedef typename Graph:: EdgeIt EdgeIt;\20 typedef typename Graph:: InEdgeIt InEdgeIt;\21 typedef typename Graph::OutEdgeIt OutEdgeIt;22 23 #define GRAPH_TYPEDEF_FACTORY_NOTYPENAME(Graph) \24 typedef Graph:: Node Node;\25 typedef Graph:: NodeIt NodeIn;\26 typedef Graph:: Edge Edge;\27 typedef Graph:: EdgeIt EdgeIt;\28 typedef Graph:: InEdgeIt InEdgeIt;\29 typedef Graph::OutEdgeIt OutEdgeIt;30 31 32 class Primes33 {34 vector<int> primes;35 int n;36 37 bool isPrime(int m)38 {39 for(int i=0;m<primes[i]*primes[i];i++) if(!(m%primes[i])) return false;40 return true;41 }42 public:43 Primes() : n(1) {}44 45 int operator() ()46 {47 if(primes.size()==0) {48 primes.push_back(2);49 return 2;50 }51 else {52 do n+=2; while(!isPrime(n));53 primes.push_back(n);54 return n;55 }56 }57 };58 14 59 15 template<class Graph>
Note: See TracChangeset
for help on using the changeset viewer.