Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2006-03-05 18:54:51


Hi there, I'm a little confused by the documentation of the
multi_array lib. The begin() is supposed to return an iterator, but
dereferencing doesn't resolve into the value type. This makes it a
little complicated to use multi_arrays with standard algorithms.
Please consider the following code snippet which wont compile on VC
7.1.

class tVoxel
{
public:

   typedef short tValue;

   tVoxel(): _oValue( 0 ) {}
   tVoxel(tValue oValue): _oValue( oValue ) {}

   void set( const tValue& oValue ) { _oValue = oValue; }

   tValue& get() { return _oValue; }
   const tValue& get() const { return _oValue; }

private:

   tValue _oValue;
};

int _tmain(int argc, _TCHAR* argv[])
{
   typedef boost::multi_array<tVoxel, 3> tVolume;

   tVolume oVolume( boost::extents[3][3][3] );

   tVolume::const_iterator iVoxel = oVolume.begin();
   tVolume::const_iterator iVoxelEnd = oVolume.end();

   const tVoxel& oVoxel = iVoxel->get();

   return 0;
}

The error message goes like:

error C2039: 'get' : is not a member of
'boost::detail::multi_array::const_sub_array<T,NumDims>'
        with
        [
            T=tVoxel,
            NumDims=2
        ]

Do I miss something important, here?

Thanks for your help,
Christian


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