Hmm, just tested my example - coupla quirks...
class SafeVoidPointer {
public:
SafeVoidPointer() : _ptr(NULL) {}
SafeVoidPointer(void *aPtr) : _ptr (aPtr) {}
SafeVoidPointer(SafeVoidPointer const &old) : _ptr (old._ptr) {}
SafeVoidPointer &operator=(SafeVoidPointer const &rhs) {
_ptr = rhs._ptr;
return *this;
}
// you may need some brackets in the next two lines
// to tell MSVC the 'truth'.
// can't dereference this void * &operator *() const { return _ptr;}
void * const *operator -> () const {return &_ptr;}
void * *operator -> () {return &_ptr;}
operator void * () { return _ptr;}
private:
void *_ptr;
};
typedef Vector<SafeVoidPointer> Array;
is a better copy, but the code in store.cc now needs to be
e = static_cast<StoreEntry*>(static_cast<void
*>(stackPop(&LateReleaseStack)));
i.e. explicity cast via void * to StoreEntry *. There's probably some
way to make the compiler perform the sequence for us..
offhand though, it will be better to simply go to a typesafe Stack class
- which is already mostly there, and long term planned anyway. I'll do
that tonight.
Rob
-- GPG key available at: <http://members.aardvark.net.au/lifeless/keys.txt>.
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:20:16 MST