c++ - pass shared_ptr as a argument to a function which accepts object of a class type -
i wondering , possible pass shared_ptr argument function accepts pointer of class type
example
class class_a_type { bla bl private: istuff *mstuff; } class istuff { public: ireporter(){}; virtual ~ireporter(){}; virtual void reportresults( class_a_result_type *presult) = 0; }; void class_a_type::sendresultback( bool status, std::string statusstring ) { boost::shared_ptr< class_a_result_type >aresultbptr( new class_a_result_type ( mstuff, getpropertyname() ) ); bool lbool = false; std::string lstr = "running"; aresultbptr->setstatus( lbool, lstr ); mystuff->reportresults( aresultbptr );// error how pass shared _ptr ?? }
you should call get
function on shared_ptr
.
mystuff->reportresults( aresultbptr.get() );
Comments
Post a Comment