extraction invariants from intensive-loop based on template parameters
Hello,
I have an algorithm like:
template
Hi,
The compiler is smart enough to prune an if condition if it knows that
the value is always false.
So if you add an if(!Lower::IsConstant) before and after your loop,
you don't have to rewrite it.
Matthieu
2009/2/19 Hicham Mouline
Hello,
I have an algorithm like:
template
class X { static void f() { .... for (size_t n=0; n<=N; ++n) { // process for j=0 at every n if Lower::IsConstant is false for (size_t j=1; j<=J-1; ++j) { } // process for j=J at every n if Upper::IsConstant is false } .... }
So I extracted the double for loop in a separate wrapper class and I verbosely wrote 4 specializations with template args begin bool :
for e.g. for
// process for j=0 once for (size_t n=0; n<=N; ++n) { for (size_t j=1; j<=J-1; ++j) { } } // process for j=J once
Any advice? Is there a better way than writing explicitly the tmpl specializations? Boost.PP maybe?
rds, _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Information System Engineer, Ph.D. Website: http://matthieu-brucher.developpez.com/ Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn: http://www.linkedin.com/in/matthieubrucher
participants (2)
-
Hicham Mouline
-
Matthieu Brucher