Skip to content

Improve Optional not to allocate on heap in case of containers #72

@Mi-La

Description

@Mi-La

Currently zserio::Optional<T> allocates on heap for objects bigger than a hard-coded threshold (3 * sizeof(void*)). However in some cases it can be worthless to allocate T on heap, especially when the T allocates on heap by itself - i.e. when T is a container. Consider std::vector and std::string (including pmr versions).

We already have similar optimization for zserio::View<T> - see #38.

Also consider to do similar improvement in zserio::Variant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions