Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

initialize boost::multi_array in a class

Tags:

For start I would like to say that I am newbie.

I am trying to initialized boost:multi_array inside my class. I know how to create a boost:multi_array:

boost::multi_array<int,1> foo ( boost::extents[1000] );

but as part of a class I have problems:

class Influx {
    public:
    Influx ( uint32_t num_elements );
    boost::multi_array<int,1> foo;

private:

};

Influx::Influx ( uint32_t num_elements ) {
    foo = boost::multi_array<int,1> ( boost::extents[ num_elements ] );
}

My program passes through compilation but during run-time I get an error when I try to accuse an element from foo (e.g. foo[0]).

How to solve this problem?