Hi Mathias,

On Fri, Jun 27, 2008 at 10:14 AM, Robert Osfield
<[EMAIL PROTECTED]> wrote:
> The error under HP-UX looks correct.  The cast is wrong as now the
> FloatArray doesn't subclass from std::vector<float> but from
> MixinVector<float>.   I will look into refactoring the code to avoid
> this.

Another data point, I've just commented out the operator
vector_type&() from MixinVector, i.e.

//    operator const vector_type&() const { return _impl; }
//    operator vector_type&() { return _impl; }

as the HeightField shape methods:

        typedef std::vector<float> HeightList;
        ....
        HeightList& getHeightList() { return *_heights; }

        const HeightList& getHeightList() const { return *_heights; }

Were relying upon the MixinVector type conversion methods, and I then get :

home/robert/OpenSceneGraph/include/osg/Shape: In member function
'std::vector<float, std::allocator<float> >&
osg::HeightField::getHeightList()':
/home/robert/OpenSceneGraph/include/osg/Shape:511: error: invalid
initialization of reference of type 'std::vector<float,
std::allocator<float> >&' from expression of type
'osg::TemplateArray<float, FloatArrayType, 1, 5126>'
/home/robert/OpenSceneGraph/include/osg/Shape: In member function
'const std::vector<float, std::allocator<float> >&
osg::HeightField::getHeightList() const':
/home/robert/OpenSceneGraph/include/osg/Shape:513: error: invalid
initialization of reference of type 'const std::vector<float,
std::allocator<float> >&' from expression of type
'osg::TemplateArray<float, FloatArrayType, 1, 5126>'

While different form the HP-UX error, it does look like it might well
be a good lead, perhaps the HP-UX compiler isn't properly picking up
on the operators in MixinVector.

As a further experiment I've changed the operator to:

    const vector_type& vector() const { return _impl; }
    vector_type& vector() { return _impl; }

And the HeightField code to:

        HeightList& getHeightList() { return _heights->vector(); }

        const HeightList& getHeightList() const { return _heights->vector(); }

Rebuild seems OK so far.

Robert.


Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to