Merge evaluate() functionnality into find_edges(), get delta for missed edges.
[goir.git] / util.hh
blob7fb42667551a2980557b96dc6f6281014db98236
1 #ifndef _GOIR_UTIL_HH
2 #define _GOIR_UTIL_HH
4 namespace goir {
5 template<typename T> inline void permute(T& a,T& b, T& c) { T t=a; a=b; b=c; c=t; }
8 #define color_components(c) (c)[0],(c)[1],(c)[2]
10 // "foreach" macros, more useful to me than BOOST_FOREACH:
12 namespace goir {
13 template<typename T>
14 struct const_iter
15 { typedef typename T::const_iterator type; };
17 template<typename T>
18 struct iter
19 { typedef typename T::iterator type; };
22 #define const_foreach(i,container) \
23 for (goir::const_iter<typeof(container)>::type i = container.begin(); \
24 i != container.end(); i++)
26 #define foreach(i,container) \
27 for (goir::iter<typeof(container)>::type i = container.begin(); \
28 i != container.end(); i++)
30 #endif // _GOIR_UTIL_HH