Boost logo

Boost Users :

From: Neil Mackie (nmackie_at_[hidden])
Date: 2003-05-15 05:24:15


I'm looking for advice on using std::max_element() with boost::multi_array.
When passing a multi_array to max_element() I was expecting to get an iterator referring to the largest element in return. However my compiler tells me the iterator refers to a
    sub_array<class RAClass::RAPoint,1>
instead, and I don't know why or what to do about it. Its clear that inexperience with multi_array and max_element() is the cause.

Is anyone able to shed some light on the subject?

Details:
¯--- .h file ¯---
namespace RAClass {
typedef boost::multi_array<RAPoint,2> CELL_TABLE;
CELL_TABLE* m_cells;
¯--- .cpp file ¯---
CELL_TABLE::iterator e = std::max_element(m_cells->begin(),m_cells->end(),
        RAPoint::lower); // RAPoint::lower() compares two RAPoints
int height = e->getHeight();

¯--- compiler output ¯---
getHeight' : is not a member of 'sub_array<class RAClass::RAPoint,1>'

TIA
Neil (J Mackie).

By the end of this year the Radiocommunications Agency and all responsibility
for regulating the radio spectrum and communications services will become part of Ofcom - the new converged regulator for the communications sector. See the Ofcom transitional website at www.Ofcom.org.uk for more details.


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