I am trying to create a QScopedPointer void with user deletion for properly managed resources coming from the C library (which only provides void * for its internal data structures). However, when I try to create an instance of QScopedPointer void, I get this error:
/Library/Frameworks/QtCore.framework/Headers/qscopedpointer.h:104:14: error: cannot form a reference to 'void' inline T &operator*() const (from Clang)
or that:
/Library/Frameworks/QtCore.framework/Headers/qscopedpointer.h:104: error: forming reference to void (from GCC)
I decided to specialize QScopedPointer or write a base pointer with user deletion, but in both cases I ended up duplicating exactly the same code that I have in QScopedPointer.
Is there any way to get rid of (or specialize) this particular function so that the compiler no longer complains?
. , . , . void - void *?
void * vptr; *vptr = ??; ?? = *vptr; f(*vptr);
.
void * - , C. ++, . , , , .
, , , .
, , ++ - , . , . . , , get(). , QScopedPointer - .