Support static_cast on FixedWidthPointer.

This commit is contained in:
Alex Smith
2012-06-22 19:55:38 +01:00
parent f124497815
commit 3a2a3367dc
8 changed files with 21 additions and 10 deletions
@@ -22,17 +22,28 @@ class FixedWidthPointer {
public:
operator Type*() const
{
return (Type *)(addr_t)fValue;
return (Type*)(addr_t)fValue;
}
template<typename OtherType>
operator OtherType*() const
{
return static_cast<OtherType*>((Type*)(addr_t)fValue);
}
Type& operator*() const
{
return *(Type *)*this;
return *((Type*)(addr_t)fValue);
}
Type* operator->() const
{
return *this;
return (Type*)(addr_t)fValue;
}
Type& operator[](size_t i) const
{
return ((Type*)(addr_t)fValue)[i];
}
FixedWidthPointer& operator=(const FixedWidthPointer& p)