Activity for Paolo Biagini

  • Paolo Biagini Paolo Biagini posted a comment on discussion General Discussion

    template<class T> class TestClass { public: TestClass<T>() { memset( &m_hi , 1 , sizeof(m_hi)); } T m_hi; }; struct v { virtual ~v() {} }; struct f { float f=0.0f; }; struct z { std::auto_ptr<v> av; }; int main() { TestClass<std::string> objTest1; TestClass<v> objTest2; TestClass<std::auto_ptr<v>> objTest3; TestClass<z> objTest4; TestClass<f> objTest5; TestClass<int> objTestOK; } [test.cpp:7]: (error) Using 'memset' on struct that contains a virtual method is unsafe, because constructor, destructor...

1