some problems about shared_ptr
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*************/
#ifndef TVALUE_H
#define TVALUE_H
template< typename tvalue >
class CValue
{
public:
CValue( tvalue value ) : value_(value) {};
private:
tvalue value_;
};
#endif
/****end*************/
/*****Type.h***********/
#ifndef TYPE_H
#define TYPE_H
#include );
Type cout<<"system pause"<
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
sorry, I forgot to change the names of those classes.
I am deeply sorry for my unconscious
/***********CValue**********/
template< typename tvalue >
class CValue
{
public:
CValue( tvalue value ) : value_(value) {};
private:
tvalue value_;
};
/***********end of CValue*********/
/***********Type**************/
template );
Type cout<<"system pause"<
participants (2)
-
Samurai Deeper
-
Steven Watanabe