[mpl::integral_c] Compiler Error with Visual Studio 2010
Hi there, shouldn't the following work: #include <boost\gil\gil_all.hpp> using namespace std; using namespace boost; int main() { typedef mpl::integral_c< unsigned char , numeric_limits< unsigned char >::max() > my_max_value_t; return 0; } Visual Studio 2010 gives me: error C2975: 'N' : invalid template argument for 'boost::mpl::integral_c', expected compile-time constant expression I'm a little surprised that this isn't working. Thanks, Christian
Hi Christian, Christian Henning wrote:
Hi there,
shouldn't the following work:
#include <boost\gil\gil_all.hpp>
using namespace std; using namespace boost;
int main() { typedef mpl::integral_c< unsigned char , numeric_limits< unsigned char >::max() > my_max_value_t;
return 0; }
The good news is, I think it should work in the future when constexpr is more widely available. On compilers that aren't there yet, you need to use something with a static constant instead. Try: #include <boost/gil/gil_all.hpp> #include <boost/integer_traits.hpp> using namespace std; using namespace boost; int main() { typedef mpl::integral_c< unsigned char , integer_traits< unsigned char >::const_max > my_max_value_t; return 0; } HTH, Nate
#include <boost/gil/gil_all.hpp> #include <boost/integer_traits.hpp>
using namespace std; using namespace boost;
int main() { typedef mpl::integral_c< unsigned char , integer_traits< unsigned char >::const_max > my_max_value_t;
return 0; }
Thanks! That works now. I'm trying to fix a bug in gil. Christian
participants (2)
-
Christian Henning
-
Nathan Crookston