Re: inhibit compiler warning C4624 for a class hierarchy
Ben Voigt <rbv@nospam.nospam> wrote:
If a class does not have a
trivial constructor, does it necessarily have a non-trivial
constructor, or can it have no constructor at all?
A class has either a trivial or a non-trivial constructor. There ain't
no such thing as a class with no declared constructor. It's possible to
have a constructor that is declared but not defined: an object with such
a constructor can never be instantiated.
By the way, you keep mentioning "a ... hierarchy of POD classes". Such a
thing does not exist:
9/4 A POD-struct is an aggregate class...
8.5.1/1 An aggregate is ... a class (clause 9) with no user-declared
constructors (12.1), no private or protected non-static data members
(clause 11), no base classes (clause 10), and no virtual functions
(10.3).
It appears that none of your classes are actually POD types. Luckily,
you don't need to meet a higher bar of using only POD types: it should
be sufficient for your purposes to have types with trivial constructor
and destructor. In particular, you can use inheritance, but you
shouldn't have any user-declared constructors or destructors.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925