Boost logo

Boost Users :

Subject: Re: [Boost-users] [multi_array] why this does not compile? allocator?
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-09-20 15:32:50


Suresh Kumar wrote:
> Could you kindly tell me why the following code does not compile? I
> guess it is an allocator issue, but how do I go further?
>
> #include <boost/multi_array.hpp>
> #include <iostream>
> using namespace std;
>
> int
> main () {
> class test{
> int x;
> int y;
> };
> typedef boost::multi_array<test, 3> array_type;
> typedef array_type::index index;
> array_type A(boost::extents[3][4][2]);
> array_type::extent_gen extents;
>
> return 0;
> }
>
> compile errors:
> multiArray.cpp:11: error: template argument for ‘template<class _Alloc>
> class std::allocator’ uses local type ‘main()::test’

This says it all. Move test out of function scope into a namespace scope.

Jeff


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