The best way would be to create template function and \ or set of overloaded functions for logging purposes:
In your example conditionCode:#include <iostream> #include <string> template <typename T> void WriteLog(const std::string &sMsg, T val) { std::cout << sMsg << val << std::endl; } int main(int argc, char* argv[]) { WriteLog("int:", 1); WriteLog("char:", '1'); WriteLog("float:", 1.0f); return 0; }
is always true, because size of pointer is always equal to size of int.Code:if(sizeof(&pVoidType) == sizeof(int))
Hob




Reply With Quote