문제

I am using dynamic_cast<void*> in a memory manager template to obtain the real address of the object. However dynamic_cast is not allowed for types that are not polymorphic. Is there a more universal way or do I need two versions of the template?

도움이 되었습니까?

해결책

You can use std::is_polymorphic to do a compile-time switch on the two possibilities.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top