How to make a pre C ++ wrapper 11 of a POD structure made in C99?

Very good. First, the question may not be in the correct format. I will modify it as I add more information or the comments show a lack of information or structure.

I have a structure made of POD, in C99.

I will give an example of the type of structure in which I usually find the one that interests me (kindly extract Freetype 2.4.4):

        typedef enum BDF_PropertyType_

} BDF_PropertyType;
typedef struct BDF_PropertyRec_
Type BDF_PropertyType;
union {
const char * atom;
FT_Int32 integer;
Cardinal FT_UInt32;

} u;

} BDF_PropertyRec;

My question is: How to get a wrapper in C ++ 98 to interconnected structures?

I planned to do a course that used a BDF_PropertyRecbut using it as a private object and using it, but I still depend on malloc and free for its life cycle, quickly abandoning the idea by keeping in mind the two objects, as they do here: -into-C -class /

Here,, apply a form of the inheritance type to get a wrapper. I do not see how to achieve this with POD structures or classical data that have pointers connected to other structures, or a vector of these elements given by the base pointer and the maximum length, something like this:

typedef struct t_Elements_used
uint8_t value1;
uint16_t value2;
uint8_t value3;
uint32_t value4;
} * Elements_used; // Look at the pointer element, here it is cheating!

typedef struct t_Structura_POD_con_vectores
uint32_t elements;
Vector elements used; // It's cheating, read the definition of the previous typedef well!

} Structure_POD_with_vectors; // <How to integrate this in a class?

In software engineering (, they comment with the help of facades or std :: make_unique. In the case of C ++ 98, std :: make_unique it does not work (you have to insert the extension TR1 or use boost, and for the moment, it is not viable), and a facade pattern adds too many layers to access the elements of this vector, which makes the difficult encapsulation (one layer for the first structure, another for the second and one for the communication between the two, leaving the original structure duplicated, but I do not see that it is accessible without copies.

As I read in Coding Standards C ++ – 101 Rules, Guidelines and Best Practices, from Herb Sutter and Andrei Alexandrescu, recommends the use of RAII (Recommendation 13), which involves duplicating and to maintain the two objects, the structure and the object. C ++ converted.

I repeat the question: How to create a wrapper in C ++ 98 (obsolete!) For a structure connected to others in C99?