mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-04 07:41:12 +00:00
Add "empty()" to vector (#8369)
This is just another `std`-ism that is being added. Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -175,6 +175,11 @@ template<typename T, typename SizeT = uoffset_t> class Vector {
|
|||||||
|
|
||||||
SizeT size() const { return EndianScalar(length_); }
|
SizeT size() const { return EndianScalar(length_); }
|
||||||
|
|
||||||
|
// Returns true if the vector is empty.
|
||||||
|
//
|
||||||
|
// This just provides another standardized method that is expected of vectors.
|
||||||
|
bool empty() const { return size() == 0; }
|
||||||
|
|
||||||
// Deprecated: use size(). Here for backwards compatibility.
|
// Deprecated: use size(). Here for backwards compatibility.
|
||||||
FLATBUFFERS_ATTRIBUTE([[deprecated("use size() instead")]])
|
FLATBUFFERS_ATTRIBUTE([[deprecated("use size() instead")]])
|
||||||
SizeT Length() const { return size(); }
|
SizeT Length() const { return size(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user