Boost Users :
From: Dale McCoy (dalestan_at_[hidden])
Date: 2006-05-02 02:41:40
On 5/2/06, chun ping wang wrote:
> Its more of a c++ question but i wonder how would I pass constant variables
> into template parameters such as nth_index_iterator.
> Example: void func(const int& var)
> Is this possible whats the work around this limitation?
Template parameters must be known at compile-time. If var is known at
compile time, changing it to a #define should work. If var is not
known at compile time, then you can't use it as a template parameter;
you'll have to find something else that'll do the job (eg
std::vector<bool> rather than std::bitmask<N>).
Strange tricks involving dynamic compiling and linking might work, but
that would be several different types of difficult.
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