在 2019/1/25 20:52, JonY via Mingw-w64-public 写道:
> On 1/25/19 12:27 PM, Nikolay Sivov wrote:
>> v2: added separate definition for C
>>
> 
> No need to repeat the members, you should be able to do something like:
> 
> struct DWRITE_FONT_METRICS1
> #ifdef __cplusplus
>   : public DWRITE_FONT_METRICS
> #endif
> {
> #ifndef __cplusplus
>     UINT16 designUnitsPerEm;
>     UINT16 ascent;
>     UINT16 descent;
>     INT16 lineGap;
>     UINT16 capHeight;
>     UINT16 xHeight;
>     INT16 underlinePosition;
>     UINT16 underlineThickness;
>     INT16 strikethroughPosition;
>     UINT16 strikethroughThickness;
> #endif
>     INT16 glyphBoxLeft;
>     INT16 glyphBoxTop;
>     INT16 glyphBoxRight;

This should be the more appropriate solution, because inheritance
provides not only those members, but also implicit conversion from
`DWRITE_FONT_METRICS1 *` to `DWRITE_FONT_METRICS *`, as well as the
ability to `static_cast` from the latter to the former, which is
otherwise impossible without `reinterpret_cast`.


-- 
Best regards,
LH_Mouse

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to