Boost logo

Boost Users :

Subject: [Boost-users] [boost] [mpl] Hard upper limit for range_c
From: Javier Dehesa (javidcf_at_[hidden])
Date: 2014-05-13 12:23:38


I was testing for_each and range_c and I've discovered that there's a
hard limit in the range_c template.

I'm attaching an example (copied from the for_each docs
http://www.boost.org/doc/libs/1_55_0/libs/mpl/doc/refmanual/for-each.html)
to illustrate it. This program compiles fine for me (g++ 4.9.0), but if
I set NUM to a number over 890, the compilation fails. I receive an
error about template instantiation depth, so I guess I could tune it in
the compiler to make it work. But, anyway, why is this template
recursively defined? Is it on purpose? I get that maybe range_c was
intended just for small ranges, but, is it the only way it can work?
Also, it only allows for statically defined range limits.

Also, whenever it compiles, the bigger the number you put, the longer it
takes to compile.

Thanks.

-- 
Javier Dehesa



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net