I'm writing a pointer class and have naturally defined the dereference operator as a member function. However, if this type is now void, I need to delete that function because you can't dereference a void pointer. But writing out that specialization itself is a syntax error:
// in ptr.h
template<typename T>
class ptr {
public:
T& operator * () const;
};
//in ptr.cpp
template<>
void& ptr<void>::operator * () const = delete;
So how can I implement this? To fix the syntax error, I have to make a syntax error?
I've tried looking in the source code for the std::unique_ptr class but I really can't make sense of that code tbh