aboutsummaryrefslogtreecommitdiffstats
path: root/executor/_include/flatbuffers/array.h
diff options
context:
space:
mode:
Diffstat (limited to 'executor/_include/flatbuffers/array.h')
-rw-r--r--executor/_include/flatbuffers/array.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/executor/_include/flatbuffers/array.h b/executor/_include/flatbuffers/array.h
index d4b73fc9e..f4bfbf054 100644
--- a/executor/_include/flatbuffers/array.h
+++ b/executor/_include/flatbuffers/array.h
@@ -17,6 +17,9 @@
#ifndef FLATBUFFERS_ARRAY_H_
#define FLATBUFFERS_ARRAY_H_
+#include <cstdint>
+#include <memory>
+
#include "flatbuffers/base.h"
#include "flatbuffers/stl_emulation.h"
#include "flatbuffers/vector.h"
@@ -35,7 +38,7 @@ template<typename T, uint16_t length> class Array {
public:
typedef uint16_t size_type;
typedef typename IndirectHelper<IndirectHelperType>::return_type return_type;
- typedef VectorIterator<T, return_type> const_iterator;
+ typedef VectorConstIterator<T, return_type, uoffset_t> const_iterator;
typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
// If T is a LE-scalar or a struct (!scalar_tag::value).
@@ -156,11 +159,13 @@ template<typename T, uint16_t length> class Array {
// Specialization for Array[struct] with access using Offset<void> pointer.
// This specialization used by idl_gen_text.cpp.
-template<typename T, uint16_t length> class Array<Offset<T>, length> {
+template<typename T, uint16_t length, template<typename> class OffsetT>
+class Array<OffsetT<T>, length> {
static_assert(flatbuffers::is_same<T, void>::value, "unexpected type T");
public:
typedef const void *return_type;
+ typedef uint16_t size_type;
const uint8_t *Data() const { return data_; }
@@ -238,6 +243,14 @@ const Array<E, length> &CastToArrayOfEnum(const T (&arr)[length]) {
return *reinterpret_cast<const Array<E, length> *>(arr);
}
+template<typename T, uint16_t length>
+bool operator==(const Array<T, length> &lhs,
+ const Array<T, length> &rhs) noexcept {
+ return std::addressof(lhs) == std::addressof(rhs) ||
+ (lhs.size() == rhs.size() &&
+ std::memcmp(lhs.Data(), rhs.Data(), rhs.size() * sizeof(T)) == 0);
+}
+
} // namespace flatbuffers
#endif // FLATBUFFERS_ARRAY_H_