mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-20 04:45:06 +00:00
Add support of Optional<T> scalars to C++ code generator (#6092)
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
namespace optional_scalars;
|
||||
|
||||
enum OptionalByte: byte {
|
||||
None = 0,
|
||||
One = 1,
|
||||
}
|
||||
|
||||
// This table tests optional scalars in tables. It should be integrated with
|
||||
// the main monster test once most languages support optional scalars.
|
||||
table ScalarStuff {
|
||||
@@ -41,4 +46,14 @@ table ScalarStuff {
|
||||
just_bool: bool;
|
||||
maybe_bool: bool = null;
|
||||
default_bool: bool = true;
|
||||
|
||||
just_enum: OptionalByte;
|
||||
// Rust code generator failed with optional<enum>
|
||||
//maybe_enum: OptionalByte = null;
|
||||
default_enum: OptionalByte = One;
|
||||
}
|
||||
|
||||
root_type ScalarStuff;
|
||||
|
||||
file_identifier "NULL";
|
||||
file_extension "mon";
|
||||
|
||||
Reference in New Issue
Block a user