Boost logo

Boost Users :

From: vlad (gvlad_at_[hidden])
Date: 2006-05-02 01:25:50


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_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of chun ping wang
Sent: Tuesday, May 02, 2006 1:54 PM
To: boost-users_at_[hidden]
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?



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