Skip to content

String gives different size at "empty" input for short/non_short #190

@ChemistAion

Description

@ChemistAion

Continuing from: #189

Consider this:

constexpr auto limit = cista::generic_string<>::short_length_limit;
using string = cista::raw::string;

auto size_m3 = string("", limit - 3).size();
auto size_m1 = string("", limit - 1).size();
auto size_m0 = string("", limit - 0).size();
auto size_p0 = string("", limit + 0).size();
auto size_p1 = string("", limit + 1).size();
auto size_p3 = string("", limit + 3).size();

Everything above small-optimization limit gives "right size", i.e.: size_p1 is 16 and size_p3 is 18, whereas non-heaps gives 0.
Would be nice to get consistent behavior here.

...be sparkled 🥳 by an idea from: #187 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions