Pointer to a generic type parameter
- From: "interX" <TK777@xxxxxx>
- Date: 23 Jan 2007 18:47:00 -0800
Hi
I'm new in VC++ and have a question to generics. I have a generic
class, which contains an array of the generic type. This array I can
pin and then I would like to get an unmanaged pointer to it. Therefore
I wanted to creat a class member which represents the pointer to the
array. Unfortunately I get the folowring compile error for the code
beneath:
error C3229: 'DataType *' : indirections on a generic type parameter
are not allowed
Is there a posible way to get a this unmanaged pointer? My problem is
that it isn't allowed to creat a pin_ptr<DataType> as a class member
and it takes quite a while to do it every function call. Or, do I I
realy have to do a hack and creat a void* from the array by using
GCHandle::Alloc(...).AddrOfPinnedObject().ToPointer() and then cast it
to a byte* and shift it each time by sizeof(DataType)?
By the way, my generic typs are never reference objects, only value
structs and data types like int, byte, ... .
Thanks for any help!
Thorsten
generic<typename DataType> public ref class RingBuffer
{
array<DataType> ^m_Buffer;
DataType *m_Buffer_Ptr; // Error
}
.
- Follow-Ups:
- Re: Pointer to a generic type parameter
- From: Ben Voigt
- Re: Pointer to a generic type parameter
- Prev by Date: Re: System::String to wstring
- Next by Date: RE: best way to check the installation of mfc80 side by side
- Previous by thread: System::String to wstring
- Next by thread: Re: Pointer to a generic type parameter
- Index(es):
Relevant Pages
|