|
Boost Users : |
From: Phil Endecott (spam_from_boost_users_at_[hidden])
Date: 2006-07-07 12:50:36
Dear All,
I am having trouble using the integer library. The following fails
to compile:
#include <boost/integer.hpp>
template <int bits>
void fn(void)
{
//typedef boost::uint_t<8>::least t;
typedef boost::uint_t<bits>::least t;
t var;
}
int main(int argc, char* argv)
{
fn<8>();
}
With g++ 4.0.0 on Linux and Boost 1.32, I get:
boost_int_test.cc: In function ââ¬Ëvoid fn()ââ¬â¢:
boost_int_test.cc:7: error: expected initializer before ââ¬Ëtââ¬â¢
boost_int_test.cc:8: error: ââ¬Ëtââ¬â¢ was not declared in this scope
boost_int_test.cc:8: error: expected `;' before ââ¬Ëvarââ¬â¢
The problem seems to occur when I use a template parameter - "bits"
in this case - as the template parameter to uint_t. If I use a
constant (as in the commented-out line) it works.
Is this a C++ feature, or a bug somewhere? Can anyone suggest a
workaround?
Thanks,
Phil.
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