eigen2 and multi_array

Hi
I was trying to use boost::multi_array in a project where I am already
using eigen2. The following lines does not compile in my code, though
it compiles correctly outside my project ie as a standalone program
where eigen is not used.
typedef multi_array

On 9/15/2010 10:14 PM, Suresh Kumar wrote:
Hi I was trying to use boost::multi_array in a project where I am already using eigen2. The following lines does not compile in my code, though it compiles correctly outside my project ie as a standalone program where eigen is not used.
typedef multi_array
array_type; array_type scores(extents[1][1]); compiler error: ‘extents’ is not a type
Any suggestions?
Looks like the Most Vexing Parse. Try adding parens: array_type scores((extents[1][1])); -- Eric Niebler BoostPro Computing http://www.boostpro.com

On Wed, Sep 15, 2010 at 7:36 PM, Eric Niebler
On 9/15/2010 10:14 PM, Suresh Kumar wrote:
Hi I was trying to use boost::multi_array in a project where I am already using eigen2. The following lines does not compile in my code, though it compiles correctly outside my project ie as a standalone program where eigen is not used.
typedef multi_array
array_type; array_type scores(extents[1][1]); compiler error: ‘extents’ is not a type
Any suggestions?
Looks like the Most Vexing Parse. Try adding parens:
array_type scores((extents[1][1]));
I tried the following and each one gives a different error: 1. array_type scores((extents[1][1])); error: expected identifier before ‘(’ token 2. array_type::extent_gen extents; array_type scores((boost::extents[1][1])); -- R Suresh Kumar, http://www.ee.ucr.edu/~sramachandranna Sarve bhavantu sukinaha (May everyone be happy) Sarve santu niramiyaha (May everyone be without affliction) Sarve bhadrani pashyantu (May everyone see only goodness) Ma kashchit dukha bhak bhavet (Let none be the victim of suffering)

On Wed, Sep 15, 2010 at 7:36 PM, Eric Niebler
On 9/15/2010 10:14 PM, Suresh Kumar wrote:
Hi I was trying to use boost::multi_array in a project where I am already using eigen2. The following lines does not compile in my code, though it compiles correctly outside my project ie as a standalone program where eigen is not used.
typedef multi_array
array_type; array_type scores(extents[1][1]); compiler error: ‘extents’ is not a type
Any suggestions?
Looks like the Most Vexing Parse. Try adding parens:
array_type scores((extents[1][1]));
I tried 3 different things and each one gives a different error: 1. array_type scores((extents[1][1])); error: expected identifier before ‘(’ token 2. array_type::extent_gen extents; array_type scores((boost::extents[1][1])); long list of errors: expected identifier before ‘(’ token error: expected unqualified-id before ‘[’ token error: expected ‘)’ before ‘[’ token error: expected ‘)’ before ‘[’ token error: ‘scores’ declared as function returning an array error: expected ‘;’ before ‘)’ token 3. array_type::extent_gen extents; array_type scores(boost::extents[1][1]); error: ‘boost::extents’ has not been declared needless to say i am going crazy with the compile errors. I am using Boost Version: 1.40.0.1 on Ubuntu 10.04 (in case this helps...) thanks suresh -- R Suresh Kumar, http://www.ee.ucr.edu/~sramachandranna Sarve bhavantu sukinaha (May everyone be happy) Sarve santu niramiyaha (May everyone be without affliction) Sarve bhadrani pashyantu (May everyone see only goodness) Ma kashchit dukha bhak bhavet (Let none be the victim of suffering)

On Thu, Sep 16, 2010 at 12:33 AM, alfC
typedef multi_array
array_type; array_type scores(extents[1][1]); compiler error: ‘extents’ is not a type
Any suggestions?
make sure you are using "boost::extents" (i.e. in namespace boost). (also note that boost::extents is not a type but a --static-- object)
I get the same error still: error: ‘boost::extents’ is not a type Any ideas/suggestions? thanks suresh -- R Suresh Kumar, http://www.ee.ucr.edu/~sramachandranna Sarve bhavantu sukinaha (May everyone be happy) Sarve santu niramiyaha (May everyone be without affliction) Sarve bhadrani pashyantu (May everyone see only goodness) Ma kashchit dukha bhak bhavet (Let none be the victim of suffering)

On Thu, Sep 16, 2010 at 11:59 AM, Suresh Kumar
On Thu, Sep 16, 2010 at 12:33 AM, alfC
wrote: typedef multi_array
array_type; array_type scores(extents[1][1]); compiler error: ‘extents’ is not a type
Any suggestions?
make sure you are using "boost::extents" (i.e. in namespace boost). (also note that boost::extents is not a type but a --static-- object)
I get the same error still: error: ‘boost::extents’ is not a type
Any ideas/suggestions?
SOLVED. I was trying to do the above in the private part of a class. Once I realised that extents is a static object, i defined my class like this. class c{ private: array_type * scores; public: c(){ scores = new array_type(boost::extents[1][1]); } }; But I still have one more question. How can I use it without using pointers? thanks suresh -- R Suresh Kumar, http://www.ee.ucr.edu/~sramachandranna Sarve bhavantu sukinaha (May everyone be happy) Sarve santu niramiyaha (May everyone be without affliction) Sarve bhadrani pashyantu (May everyone see only goodness) Ma kashchit dukha bhak bhavet (Let none be the victim of suffering)
participants (3)
-
alfC
-
Eric Niebler
-
Suresh Kumar