
2 May
2006
2 May
'06
6:41 a.m.
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) { nth_index_iterator<var>::type; }
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. Dale