[C++] Add Vector64 specialization for std::vector<bool> (#8757)

* add vector64 specialization for vector<bool>

* fix generated code

---------

Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
This commit is contained in:
Justin Davis
2025-11-17 16:44:28 -05:00
committed by GitHub
parent e3ee24830e
commit e68355cb22
9 changed files with 180 additions and 106 deletions

View File

@@ -18,6 +18,10 @@ table RootTable {
// A normal 32-bit sized string, that could be very far away (64-bit address).
far_string:string (offset64);
// a big vector of bool, that could be very far away (64-bit address).
// tests vector<bool> specialization with 64-bit offsets.
big_bool_vector:[ubyte] (vector64);
// A big 64-bit sized vector, that could be very far away (64-bit address).
big_vector:[ubyte] (vector64);
@@ -27,19 +31,19 @@ table RootTable {
// A big 64-bit sized vector that is a nested flatbuffers (64-bit address).
nested_root:[ubyte] (vector64, nested_flatbuffer: "RootTable");
// A normal 32-bit size vector of structs, that could be very far away
// A normal 32-bit size vector of structs, that could be very far away
// (64-bit address)
far_struct_vector:[LeafStruct] (offset64);
// A big 64-bit size vector of structs that could be very far away
// A big 64-bit size vector of structs that could be very far away
// (64-bit address)
big_struct_vector:[LeafStruct] (vector64);
// A normal 32-bit size vector of tables. Currently 64-bit vectors don't
// A normal 32-bit size vector of tables. Currently 64-bit vectors don't
// support tables as it would require serializing a table (32-bit) before the
// vector (64-bit), which is not allowed.
//
// This demonstrates how you could have many vectors in the buffer, by
// This demonstrates how you could have many vectors in the buffer, by
// effectively having a vector of 64-bit vectors. The IDL doesn't support
// nested vecotrs (e.g.: [[type]] ), so going through a wrapper table allows
// this.
@@ -50,4 +54,4 @@ table RootTable {
forced_aligned_vector:[ubyte] (vector64, force_align:32);
}
root_type RootTable;
root_type RootTable;