I believe the compiler is complaining that ref_ptr<BaseClass> is a different
(and incompatible) type from ref_ptr<SubClass>. Try the following and see if
it helps.
vec.push_back( dynamic_cast<BaseClass>((*item).get()) );
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com <http://www.skew-matrix.com/> 
303 859 9466


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Panagiotis
Papadakos
Sent: Saturday, February 03, 2007 8:07 AM
To: [email protected]
Subject: [osg-users] osg::ref_ptr problem



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/

Reply via email to