I'm trying the current OSG CVS against some of my own code and I'm
hitting compile errors I haven't hit before. I'm wondering if this is
related to the new changes in osg::ref_ptr.

One problem is in the 3rd party osgIntersect library. The code snippet is:

template <class Gen>
class GenHit: public HitBase
{
public:
...
        bool operator < (const GenHit& hit) const
        {
        if (_originalGen<hit._originalGen) return true; // this compiles
        if (_originalGen>hit._originalGen) return false;  // compile error here
        return _ratio<hit._ratio;
        }

        osg::ref_ptr<Gen>         _originalGen;
        osg::ref_ptr<Gen>         _localGen;
};

It seems that the > operator is causing problems. Here is the error:

/Volumes/DataPartition/Users/ewing/DEVELOPMENT/OSG/OSGINTERSECT/Xcode/osgIntersect/../../osgintersect/osgIntersector/osg_gen_intersectvisitor.h:147:
error: no match for 'operator>' in '((const
osgIsect::GenHit<osgIsect::RefPolytopeIsector>*)this)->osgIsect::GenHit<osgIsect::RefPolytopeIsector>::_originalGen
hit->osgIsect::GenHit<osgIsect::RefPolytopeIsector>::_originalGen'

I'm not sure why this suddenly doesn't work or what the proper fix for this is.


Here is another error in some of my own code. It seems that using
const_iterator is causing me problems I didn't used to have.

uint32_t osgTraceTypical::GetIndexForLowerBoundX(float x) const
{
        uint32_t index;
        osg::Vec3Array::const_iterator iter;
//      osg::Vec3Array::iterator iter; // Have to use non-const to work
        osg::Vec3 point(x, 0.0, 0.0);

        iter = std::lower_bound(traceBaseVertexArray.get()->begin(),
traceBaseVertexArray.get()->end(), point,
&osgTraceTypical::CompareVec3ByXIsLessThan);
        // Convert iterator to index value
        index = std::distance(traceBaseVertexArray.get()->begin(), iter);
        return index;
}

/Volumes/DataPartition/Users/ewing/DEVELOPMENT/Spectral/SVN/osgCocoaPlot/osgPlot/trunk/osgTraceTypical.cpp:103:
error: no matching function for call to
'distance(__gnu_cxx::__normal_iterator<osg::Vec3*,
std::vector<osg::Vec3, std::allocator<osg::Vec3> > >,
__gnu_cxx::__normal_iterator<const osg::Vec3*, std::vector<osg::Vec3,
std::allocator<osg::Vec3> > >&)'

If I switch to a regular iterator instead of const_iterator, the code
compiles in this case. But it seems that I should be able to use a
const_iterator here legitimately.

Any suggestions?

Thanks,
Eric
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to