10 Nov
2010
10 Nov
'10
10:33 p.m.
Hi, I found that the following lines made errors: // OwnPtrCommon.h template <typename T> inline void deleteOwnedPtr(T* ptr) { typedef char known[sizeof(T) ? 1 : -1]; if (sizeof(known)) delete ptr; } I am very curious about why the author wrote like the above. What could be the author's intention? For error-fix, I changed it like the following: template <typename T> inline void deleteOwnedPtr(T* ptr) { if(sizeof(T)>0) delete ptr; } What could be the above code's mistake? Thanks, Daebark