Original Post
Guru programmers out there: Is there anything potentially wrong with the following code? Usage as follows:
// Returns A Unique Integer for every Type
template <typename T>
inline Int64 typeof (const T& rT)
{
static T data;
return reinterpret_cast <Int64>((void*)&data);
}
...
// These examples arn't very sensible, but they show how it could be used
template <typename T1, typename T2>
bool isSameType (const T1& rT1, const T2& rT2)
{
return (typeof (rT1) == typeof (rT2));
}
....
class Any
{
public:
template <typename T>
Any (const T& rT)
{
....
}
template <typename T>
T cast ()
{
assert (type_ = typeof (T()));
return reinterpret_cast <T>(pData_);
}
...
private:
void* pData_;
Int64 type_;
}
...