Boost logo

Boost Users :

Subject: [Boost-users] [boost-users][array] Passing by reference
From: Ryan McConnehey (mccorywork_at_[hidden])
Date: 2010-02-25 20:59:20


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<typename T, typename S>
void extract (boost::array<T, S> & var) {}


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