[C++] Use a custom optional instead of std::optional
for non-scalar type
#359
Labels
enhancement
New feature or request
std::optional
for non-scalar type
#359
Is your feature request related to a problem? Please describe.
Currently bebop use concrete type when generating a field with non-scalar types. This make things simple since everything is value-based, but prevents user to make cyclic dependency which gracefully prevented in #111.
Describe the solution you'd like
I would like to suggest to revise and support cyclic dependency instead. Here what I had in mind:
std::optional
implementation, but instead of use value type, use heap (e.g smart pointer). This is relatively simple to do.std::optional
use extra 1 byte only) and it loss cache locality. Thus, this custom optional should only be used only for non-scalar type where the size is trivialDescribe alternatives you've considered
The easiest way (and relatively safe) to do this is to expose smart pointer for non-scalar type. But this would be a breaking change to the user.
Additional context
N/A
The text was updated successfully, but these errors were encountered: