i am using a boost::array which has the format
< char, const std::size_t >
void test(const std::size_t XXX)
{
boost::shared_ptr<boost::array<unsigned char, XXX>> buf(new boost::array<unsigned char, max_size>);
.
.
.
};
test(100);
test(20);
This is leading
to the Error:
error C2971: ‘boost::array’ : template parameter ‘N’ : ‘size’ : a local variable cannot be used as a non-type argument
Can you give me a hint how to pass boost::array the second parameter?
thanks
Templates are instantiated during the compilation, so that their parameters have to be known before the program runs.
That means you cannot use a variable as a template parameter. Such a parameters must be constant expressions (constant variables is not enough), addresses of functions or objects with external linkage, or addresses of static class members.