Summary: | Forbid the creation of PlainObjectBase object | ||
---|---|---|---|
Product: | Eigen | Reporter: | Gael Guennebaud <gael.guennebaud> |
Component: | Core - general | Assignee: | Nobody <eigen.nobody> |
Status: | RESOLVED FIXED | ||
Severity: | API Change | CC: | chtz, gael.guennebaud, jacob.benoit.1, nathan.yonkee |
Priority: | Normal | ||
Version: | 3.3 (current stable) | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 558 |
Description
Gael Guennebaud
2015-09-28 14:00:31 UTC
I also see no legit use of directly creating a PlainObjectBase<> (nor any other ...Base<>-object -- which in many cases would be an empty object, which behaves as if it contained data). To implement this, wouldn't it be sufficient to make all constructors (and destructors, if needed) protected? Of course, this would leave the possibility to inherit class WeirdClass : PlainObjectBase<SomeOtherClass> { ... }; but we can't avoid every possibility to shoot oneself in the foot ... yes, making them protected is definitely enough! What about making the destructor of PlainObjectBase<typename> a pure virtual function? This would need only two additional lines of code and no changes to any of the derived classes. We use pure static polymorphism in Eigen (no virtual functions). A pure virtual destructor is actually rather complicated (I was surprised that it is even possible ...) -- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1074. |