[boost-users][array] Passing by reference

I'm wanting to pass a boost::array by reference to a function.
Normally, this isn't a problem. My first approach yielded a compiler
error stating boost::array needs template parameters. When adding the
template parameters (approach 2) the compiler then states boost::array
needs T to be a compile time constant. I want the function to be able
to take different boost::array sizes. Can boost::array be passed by
reference without knowing the size of the array at compile time? Any
help would be great.
Ryan
Approach 1
void extract (boost::array & var) {}
Approach 2
template

AMDG Ryan McConnehey wrote:
I'm wanting to pass a boost::array by reference to a function. Normally, this isn't a problem. My first approach yielded a compiler error stating boost::array needs template parameters. When adding the template parameters (approach 2) the compiler then states boost::array needs T to be a compile time constant. I want the function to be able to take different boost::array sizes. Can boost::array be passed by reference without knowing the size of the array at compile time? Any help would be great.
Ryan
Approach 1 void extract (boost::array & var) {}
Approach 2 template
void extract (boost::array & var) {}
Try
template

Steven Watanabe wrote:
AMDG
Ryan McConnehey wrote:
I'm wanting to pass a boost::array by reference to a function. Normally, this isn't a problem. My first approach yielded a compiler error stating boost::array needs template parameters. When adding the template parameters (approach 2) the compiler then states boost::array needs T to be a compile time constant. I want the function to be able to take different boost::array sizes. Can boost::array be passed by reference without knowing the size of the array at compile time? Any help would be great.
Ryan
Approach 1 void extract (boost::array & var) {}
Approach 2 template
void extract (boost::array & var) {} Try
template
void extract(boost::array & var) {} In Christ, Steven Watanabe That worked. Thanks.
Ryan
participants (2)
-
Ryan McConnehey
-
Steven Watanabe