google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library

Home Page:https://flatbuffers.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[c++] vector of tables is not sorted when using object api

jawadsh123 opened this issue Β· comments

commented

Hey! πŸ‘‹

When using --gen-object-api and schema

table KeyValue {
  key:string (key);
  value:string;
}

table Root {
  values:[KeyValue]
}

root_type Root;

the generated Pack(ing) code for values uses CreateVector and not CreateVectorOfSortedTables

this is also apparent in one of the tests

auto _scalar_key_sorted_tables = _o->scalar_key_sorted_tables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Stat>> (_o->scalar_key_sorted_tables.size(), [](size_t i, _VectorArgs *__va) { return CreateStat(*__va->__fbb, __va->__o->scalar_key_sorted_tables[i].get(), __va->__rehasher); }, &_va ) : 0;

is this intentional or is it a 🐞?

@sunwen18 Want to take a stab at this one?

@sunwen18 Want to take a stab at this one?

Sure, I can take a look.

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

This issue was automatically closed due to no activity for 6 months plus the 14 day notice period.