Open tkzcfc opened 2 years ago
@tkzcfc You are not taking the copy/move constructors into consideration. Add:
TestClass(const TestClass&) { printf("TestClass ctor\n"); }
TestClass(const TestClass&&) { printf("TestClass ctor\n"); }
And it works fine. Don't forget that with policy::ctor::as_object
you are working with objects rather than pointers.
Hello, why is the destructor called twice for the first time?
console output:
00000000000000 TestClass ctor ~TestClass ~TestClass 11111111111111 TestClass ctor ~TestClass 22222222222222 TestClass ctor 333333333333333333 ~TestClass 444444444444444444