[C++] Fix Undefined behavior for zero length vectors (#5355)
[C++] Fix Undefined behavior for zero length vectors (#5355)

* Fix Undefined behavior for zero length vectors

* Change fix for UBSan

google/flatbuffers,evolutional/flatbuffers,DavadDi/flatbuffers,pjulien/flatbuffers,evolutional/flatbuffers,google/flatbuffers,google/flatbuffers,evolutional/flatbuffers,google/flatbuffers,pjulien/flatbuffers,evolutional/flatbuffers,pjulien/flatbuffers,DavadDi/flatbuffers,google/flatbuffers,stewartmiles/flatbuffers,stewartmiles/flatbuffers,royalharsh/flatbuffers,google/flatbuffers,stewartmiles/flatbuffers,alexames/flatbuffers,stewartmiles/flatbuffers,alexames/flatbuffers,google/flatbuffers,pjulien/flatbuffers,stewartmiles/flatbuffers,alexames/flatbuffers,evolutional/flatbuffers,pjulien/flatbuffers,evolutional/flatbuffers,royalharsh/flatbuffers,alexames/flatbuffers,stewartmiles/flatbuffers,pjulien/flatbuffers,evolutional/flatbuffers,alexames/flatbuffers,stewartmiles/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,pjulien/flatbuffers,alexames/flatbuffers,royalharsh/flatbuffers,google/flatbuffers,stewartmiles/flatbuffers,DavadDi/flatbuffers,stewartmiles/flatbuffers,royalharsh/flatbuffers,stewartmiles/flatbuffers,royalharsh/flatbuffers,evolutional/flatbuffers,pjulien/flatbuffers,royalharsh/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,pjulien/flatbuffers,evolutional/flatbuffers,alexames/flatbuffers,google/flatbuffers,stewartmiles/flatbuffers,evolutional/flatbuffers,alexames/flatbuffers,pjulien/flatbuffers,stewartmiles/flatbuffers,alexames/flatbuffers,royalharsh/flatbuffers,pjulien/flatbuffers,google/flatbuffers,alexames/flatbuffers,DavadDi/flatbuffers,evolutional/flatbuffers,google/flatbuffers,royalharsh/flatbuffers,alexames/flatbuffers,google/flatbuffers,evolutional/flatbuffers,pjulien/flatbuffers,google/flatbuffers,stewartmiles/flatbuffers,DavadDi/flatbuffers,royalharsh/flatbuffers,evolutional/flatbuffers,alexames/flatbuffers,DavadDi/flatbuffers,royalharsh/flatbuffers