Represent an optional attribute as a C++ class member
问题 I am generating C++ code based on a schema. There are entities and each entity contain attribute(s) with each attribute having a corresponding data type. Now the problem is some of these attributes are "optional", meaning that they do not have to be part of the class declaration. However, in C++, something is either a member of class or not a member of class, there is no concept such as "optional data member". Entities will be the class names, and attributes will be the class members. I am