You can pass constant to template parameter. But you cannot pass constant reference. Look:

 

const int var=1;

nth_index_iterator<var>::type; //ok

 

const int& var2=var;

nth_index_iterator<var2>::type; //error

 


From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of chun ping wang
Sent: Tuesday, May 02, 2006 1:54 PM
To: boost-users@lists.boost.org
Subject: [Boost-users] passing variable into template parameters.

 

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?