flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

[C++] get default value for field

Open giuliomoro opened this issue 1 year ago • 5 comments

Is it possible to get the default value for a field?

I find myself wanting to get the default value without having to build and/or parse an object. Ideally, in C++ that value should be available as a constexpr. As far as I can see, currently the default value is hardcoded in several places in the *_generated.h header but there is no way of getting it without creating an object.

giuliomoro avatar Aug 18 '23 23:08 giuliomoro

Not currently, but I would be supportive of such a constexpr accessor.

dbaileychess avatar Nov 18 '23 23:11 dbaileychess

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.

github-actions[bot] avatar May 19 '24 20:05 github-actions[bot]

Hi, may I take this up? Looks like something I can contribute to.

tktushar avatar May 27 '24 15:05 tktushar