S
software
Hello,
I am a new bee to c++/cli, here's my question: I have a template
version of a smart pointer class I can't use in my application because
I need to use it in more than one assembly. I thought of rewriting the
class as a generic class to avoid this problem. Unfortuneatly it is
not possible to use Pointers inside generic classes.
Code:
generic< typename T> public ref class GenericSmartPtr
{
private:
T* ptr;
public:
GenericSmartPtr() : ptr(nullptr) {}
GenericSmartPtr(T* t) {ptr = t;}
!GenericSmartPtr() {delete ptr;}
~GenericSmartPtr() {this->!GenericSmartPtr();}
}
this compiles with Error C3229
If I'd used template instead of generic this would compile, but cannot
be used outside the assembly, which is necessary.
Please help me your ideas!
Jens
I am a new bee to c++/cli, here's my question: I have a template
version of a smart pointer class I can't use in my application because
I need to use it in more than one assembly. I thought of rewriting the
class as a generic class to avoid this problem. Unfortuneatly it is
not possible to use Pointers inside generic classes.
Code:
generic< typename T> public ref class GenericSmartPtr
{
private:
T* ptr;
public:
GenericSmartPtr() : ptr(nullptr) {}
GenericSmartPtr(T* t) {ptr = t;}
!GenericSmartPtr() {delete ptr;}
~GenericSmartPtr() {this->!GenericSmartPtr();}
}
this compiles with Error C3229
If I'd used template instead of generic this would compile, but cannot
be used outside the assembly, which is necessary.
Please help me your ideas!
Jens