google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library
https://flatbuffers.dev/
Apache License 2.0
23.28k stars 3.25k forks source link

[C++] Use explicit on constructors with one arg #4448

Closed aaronovz1 closed 7 years ago

aaronovz1 commented 7 years ago

Something minor I noticed. The generated C++ code does not use the "explicit" keyword for constructors with one argument.

aardappel commented 7 years ago

Which, in particular? You mean for struct types that only have 1 field?

aaronovz1 commented 7 years ago

It seems to be the *Builder structs that pass in one arg which is the FBB:

AdapterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
aardappel commented 7 years ago

Ahh ok. Can you create a PR that adds explicit there ?

aaronovz1 commented 7 years ago

Done. See #4452