Make sure your base class derives from osg::Referenced.

jeff


Panagiotis Papadakos wrote:

Hello.

I have a vector with elements of osg::ref_ptr<SubClass>, where SubClass inherits from baseClass,

and I want to create a vector with elements osg::ref_ptr<BaseClass>. How can I do it?

BaseClassVector vec;

SubClassVector::iterator item = m_Items.begin();

for(;item != m_Items.end();++item) {

vec.push_back(*item);

}

G++ throws the following error for this code:

no matching function for call to ‘std::vector<osg::ref_ptr<BaseClass>, std::allocator<osg::ref_ptr<BaseClass> > >::push_back(osg::ref_ptr<SubClass>&)’

Thanks.

--

Papadakos Panagiotis


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



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

Reply via email to