This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++ variable-length array?


Using gcc-4.1.1.  Info says variable-length array is supported in c++ mode,
but doesn't seem to work:

#include <boost/range.hpp>
#include <vector>

template<typename in_t>
void F (in_t const& in, int size, int x[size]) {}

void G (std::vector<int> const& in, int size, int x[size]) {}

int main () {
  std::vector<int> i (10);
  int x (10);
  F (i, boost::size (i), x);
  G (i, boost::size (i), x);
}
g++ -c Test.cc -I /usr/local/src/boost.cvs
Test.cc:5: error: âsizeâ was not declared in this scope
Test.cc:7: error: âsizeâ was not declared in this scope
Test.cc: In function âint main()â:
Test.cc:12: error: no matching function for call to âF(std::vector<int,
std::allocator<int> >&, size_t, int&)â
Test.cc:7: error: too many arguments to function âvoid G(const
std::vector<int, std::allocator<int> >&, int)â
Test.cc:13: error: at this point in file



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]