Boost logo

Boost Users :

Subject: [Boost-users] [multi_array] Accessing elements via an iterator
From: Bill Buklis (boostusr_at_[hidden])
Date: 2012-02-08 14:27:30


Given this simple definition for multi_array:

struct data
{
     int value;
};

typedef boost::multi_array<data, 3> array_type;

array_type a;

Can someone tell me why pointer dereferencing, i.e. operator->, an
element does not successfully compile? Normal derefencing does work,
i.e. operator*. Am I doing something wrong or is this a problem with
multi_array?

For example:

// Successfully compiles
(*a.begin()->begin()->begin()).value = 10;

// Does NOT compile
a.begin()->begin()->begin()->value = 10;

I'm using MSVC 2010 and it returns an error that "pointer to reference
is illegal". I'm using multi_array from the trunk section.

-- 
Bill

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