#pragma once #include #include "dxxsconf.h" template class exact_type { T *p; public: operator bool() const = delete; // Conversion to void* variants is prohibited operator void *() const = delete; operator volatile void *() const = delete; operator const void *() const = delete; operator const volatile void *() const = delete; template bool operator<(U &&) const = delete; template bool operator<=(U &&) const = delete; template bool operator>(U &&) const = delete; template bool operator>=(U &&) const = delete; template bool operator!=(U &&rhs) const { return !operator==(static_cast(rhs)); } exact_type(T *t) : p(t) {} // Conversion to the exact type is permitted operator const T *() const { return p; } operator typename std::remove_const::type *() const { return p; } bool operator==(const T *rhs) const { return p == rhs; } }; template class prohibit_void_ptr { public: // Return a proxy when the address is taken exact_type operator&() { return static_cast(this); } exact_type operator&() const { return static_cast(this); } };