AMDG Samurai Deeper wrote:
I am a newbie of C++ and I have some question about the shared_ptr I think the best way to explain it is with an example:
/*******beginning of CValue.h*************/ <snip> /****end*************/
/*****Type.h***********/
<snip>
template
struct Type { typedef boost::shared_ptr< Value<T> > pValue; };
What is the point of Type? It appears to be gratuitous complexity to me.
/********end************/
what if I want to make it as a composition class?
What do you mean by a composition class?
by example
/***************example**********/ #include "Type.h" #include "CValue.h"
template<typename T> class DIP //digital image processing { public: DIP(); virtual ~DIP(); shared_ptr < Type
>createMediumFilter(); };
What is filter here? Also, did you mean the
Type
<snip> /*****************end**************/
I want to create the instance of mediumFilter like this in the main function
int main() { Type
::pValue C(new Composition );
Type
::pValue D; D = C->createCValue(); cout<<"system pause"<
how could I fix the problems
I've read through this several times, and I'm afraid that I don't understand what you're trying to do. In Christ, Steven Watanabe