|
Boost Users : |
Subject: Re: [Boost-users] some problems about shared_ptr
From: Samurai Deeper (typhoonking77_at_[hidden])
Date: 2010-09-10 22:07:24
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<typename T, template <typename> class Value>
struct Type
{
typedef boost::shared_ptr< Value<T> > pValue;
};
/********end of Type************/
/**********Composition**********/
template<typename T>
class Composition //digital image processing
{
public:
Composition();
virtual ~Composition();
shared_ptr< T > createCValue();
};
template<typename T>
Composition<T>::Composition()
{}
template<typename T>
Composition<T>::~Composition()
{}
template<typename T>
shared_ptr< T > Composition<T>::createCValue()
{
typename Type<T, CValue>::pValue c(new Composition< T >);
return c;
}
/*********end of composition***********/
/**********main************/
int main()
{
Type<matrix<double>, Composition>::pValue C(new Composition<matrix<double>
>);
Type<matrix<double>, CValue>::pValue D;
D = C->createCValue();
cout<<"system pause"<<endl;
cin.get();
}
/*********end of main********/
I hope I could create the instance of CValue through class Composition
so I wrote a "createCvalue" function in the class Composition
-- View this message in context: http://old.nabble.com/some-problems-about-shared_ptr-tp29674340p29682576.html Sent from the Boost - Users mailing list archive at Nabble.com.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net