You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently every any has a built-in descriptor support. To support it for upcasted any instances, there is a scary piece of code:
auto* p = reinterpret_cast<const value_type*>(vtable_ptr);
do {
--p;
} while (*p);
auto* type_desc_ptr = reinterpret_cast<const std::byte*>(p) - offsetof(vtable_with_metainfo<>, terminator);
return *reinterpret_cast<constdescriptor_t*>(type_desc_ptr);
It goes back, searching for a nullptr entry in the beginning, then assumes that next goes the descriptor. We at userver think that such code is unnecessarily scary.
Descriptors can be implemented as a regular requirement, as e.g. Boost.TypeErasure does. Then no special logic will be needed to retrieve the corresponding vtable slot.
The text was updated successfully, but these errors were encountered:
Currently every
any
has a built-indescriptor
support. To support it for upcastedany
instances, there is a scary piece of code:It goes back, searching for a
nullptr
entry in the beginning, then assumes that next goes the descriptor. We at userver think that such code is unnecessarily scary.Descriptors can be implemented as a regular requirement, as e.g. Boost.TypeErasure does. Then no special logic will be needed to retrieve the corresponding vtable slot.
The text was updated successfully, but these errors were encountered: