Boost logo

Boost :

Subject: Re: [boost] Review Manager needed for the C++14 Reflections Library that works Without Macro nor Markup (ex magic_get)
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2016-10-20 09:50:43

четверг, 20 октября 2016 г. пользователь Louis Dionne написал:
> Quick question: In the documentation, you say
>> C++14 limitations (C++17 fixes those):
>> * T must be POD and must not contain references nor bitfields
>> * T must not contain pointers to user defined types
>> Enums will be returned as their underlying type
>> All the methods that provide access to filds have a reinterpret_cast to
> unrelated type. All the possible efforts and compiler scpecific tricks
> were
> used to avoid issues. But strictly speaking this is an Undefined
> How does C++17 fix the last point about UB?

In C++17 structured binding is used instead of a reinterpret_cast: instead
of forming an unrelated type with same layout and reinterpret_casting user
provided variable to that type, in C++17 fields count in user provided type
is detected and structured binding for that particular fields count is used
on a user provided variable, then a tuple of references to fields of the
user provided variable is returned.

Best regards,
Antony Polukhin

Boost list run by bdawes at, gregod at, cpdaniel at, john at