Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-27 09:30:28

0001 /*
0002  * Copyright 2017 Google Inc. All rights reserved.
0003  *
0004  * Licensed under the Apache License, Version 2.0 (the "License");
0005  * you may not use this file except in compliance with the License.
0006  * You may obtain a copy of the License at
0007  *
0008  *     http://www.apache.org/licenses/LICENSE-2.0
0009  *
0010  * Unless required by applicable law or agreed to in writing, software
0011  * distributed under the License is distributed on an "AS IS" BASIS,
0012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013  * See the License for the specific language governing permissions and
0014  * limitations under the License.
0015  */
0016 
0017 #ifndef FLATBUFFERS_STL_EMULATION_H_
0018 #define FLATBUFFERS_STL_EMULATION_H_
0019 
0020 // clang-format off
0021 #include "flatbuffers/base.h"
0022 
0023 #include <string>
0024 #include <type_traits>
0025 #include <vector>
0026 #include <memory>
0027 #include <limits>
0028 
0029 #ifndef FLATBUFFERS_USE_STD_OPTIONAL
0030   // Detect C++17 compatible compiler.
0031   // __cplusplus >= 201703L - a compiler has support of 'static inline' variables.
0032   #if (defined(__cplusplus) && __cplusplus >= 201703L) \
0033       || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
0034     #define FLATBUFFERS_USE_STD_OPTIONAL 1
0035   #else
0036     #define FLATBUFFERS_USE_STD_OPTIONAL 0
0037   #endif // (defined(__cplusplus) && __cplusplus >= 201703L) ...
0038 #endif // FLATBUFFERS_USE_STD_OPTIONAL
0039 
0040 #if FLATBUFFERS_USE_STD_OPTIONAL
0041   #include <optional>
0042 #endif
0043 
0044 #ifndef FLATBUFFERS_USE_STD_SPAN
0045   // Testing __cpp_lib_span requires including either <version> or <span>,
0046   // both of which were added in C++20.
0047   // See: https://en.cppreference.com/w/cpp/utility/feature_test
0048   #if defined(__cplusplus) && __cplusplus >= 202002L \
0049       || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
0050     #define FLATBUFFERS_USE_STD_SPAN 1
0051   #endif
0052 #endif // FLATBUFFERS_USE_STD_SPAN
0053 
0054 #if defined(FLATBUFFERS_USE_STD_SPAN)
0055   #include <array>
0056   #include <span>
0057 #else
0058   // Disable non-trivial ctors if FLATBUFFERS_SPAN_MINIMAL defined.
0059   #if !defined(FLATBUFFERS_TEMPLATES_ALIASES)
0060     #define FLATBUFFERS_SPAN_MINIMAL
0061   #else
0062     // Enable implicit construction of a span<T,N> from a std::array<T,N>.
0063     #include <array>
0064   #endif
0065 #endif // defined(FLATBUFFERS_USE_STD_SPAN)
0066 
0067 // This header provides backwards compatibility for older versions of the STL.
0068 namespace flatbuffers {
0069 
0070 #if defined(FLATBUFFERS_TEMPLATES_ALIASES)
0071   template <typename T>
0072   using numeric_limits = std::numeric_limits<T>;
0073 #else
0074   template <typename T> class numeric_limits :
0075     public std::numeric_limits<T> {};
0076 #endif  // defined(FLATBUFFERS_TEMPLATES_ALIASES)
0077 
0078 #if defined(FLATBUFFERS_TEMPLATES_ALIASES)
0079   template <typename T> using is_scalar = std::is_scalar<T>;
0080   template <typename T, typename U> using is_same = std::is_same<T,U>;
0081   template <typename T> using is_floating_point = std::is_floating_point<T>;
0082   template <typename T> using is_unsigned = std::is_unsigned<T>;
0083   template <typename T> using is_enum = std::is_enum<T>;
0084   template <typename T> using make_unsigned = std::make_unsigned<T>;
0085   template<bool B, class T, class F>
0086   using conditional = std::conditional<B, T, F>;
0087   template<class T, T v>
0088   using integral_constant = std::integral_constant<T, v>;
0089   template <bool B>
0090   using bool_constant = integral_constant<bool, B>;
0091   using true_type  = std::true_type;
0092   using false_type = std::false_type;
0093 #else
0094   // MSVC 2010 doesn't support C++11 aliases.
0095   template <typename T> struct is_scalar : public std::is_scalar<T> {};
0096   template <typename T, typename U> struct is_same : public std::is_same<T,U> {};
0097   template <typename T> struct is_floating_point :
0098         public std::is_floating_point<T> {};
0099   template <typename T> struct is_unsigned : public std::is_unsigned<T> {};
0100   template <typename T> struct is_enum : public std::is_enum<T> {};
0101   template <typename T> struct make_unsigned : public std::make_unsigned<T> {};
0102   template<bool B, class T, class F>
0103   struct conditional : public std::conditional<B, T, F> {};
0104   template<class T, T v>
0105   struct integral_constant : public std::integral_constant<T, v> {};
0106   template <bool B>
0107   struct bool_constant : public integral_constant<bool, B> {};
0108   typedef bool_constant<true>  true_type;
0109   typedef bool_constant<false> false_type;
0110 #endif  // defined(FLATBUFFERS_TEMPLATES_ALIASES)
0111 
0112 #if defined(FLATBUFFERS_TEMPLATES_ALIASES)
0113   template <class T> using unique_ptr = std::unique_ptr<T>;
0114 #else
0115   // MSVC 2010 doesn't support C++11 aliases.
0116   // We're manually "aliasing" the class here as we want to bring unique_ptr
0117   // into the flatbuffers namespace.  We have unique_ptr in the flatbuffers
0118   // namespace we have a completely independent implementation (see below)
0119   // for C++98 STL implementations.
0120   template <class T> class unique_ptr : public std::unique_ptr<T> {
0121     public:
0122     unique_ptr() {}
0123     explicit unique_ptr(T* p) : std::unique_ptr<T>(p) {}
0124     unique_ptr(std::unique_ptr<T>&& u) { *this = std::move(u); }
0125     unique_ptr(unique_ptr&& u) { *this = std::move(u); }
0126     unique_ptr& operator=(std::unique_ptr<T>&& u) {
0127       std::unique_ptr<T>::reset(u.release());
0128       return *this;
0129     }
0130     unique_ptr& operator=(unique_ptr&& u) {
0131       std::unique_ptr<T>::reset(u.release());
0132       return *this;
0133     }
0134     unique_ptr& operator=(T* p) {
0135       return std::unique_ptr<T>::operator=(p);
0136     }
0137   };
0138 #endif  // defined(FLATBUFFERS_TEMPLATES_ALIASES)
0139 
0140 #if FLATBUFFERS_USE_STD_OPTIONAL
0141 template<class T>
0142 using Optional = std::optional<T>;
0143 using nullopt_t = std::nullopt_t;
0144 inline constexpr nullopt_t nullopt = std::nullopt;
0145 
0146 #else
0147 // Limited implementation of Optional<T> type for a scalar T.
0148 // This implementation limited by trivial types compatible with
0149 // std::is_arithmetic<T> or std::is_enum<T> type traits.
0150 
0151 // A tag to indicate an empty flatbuffers::optional<T>.
0152 struct nullopt_t {
0153   explicit FLATBUFFERS_CONSTEXPR_CPP11 nullopt_t(int) {}
0154 };
0155 
0156 #if defined(FLATBUFFERS_CONSTEXPR_DEFINED)
0157   namespace internal {
0158     template <class> struct nullopt_holder {
0159       static constexpr nullopt_t instance_ = nullopt_t(0);
0160     };
0161     template<class Dummy>
0162     constexpr nullopt_t nullopt_holder<Dummy>::instance_;
0163   }
0164   static constexpr const nullopt_t &nullopt = internal::nullopt_holder<void>::instance_;
0165 
0166 #else
0167   namespace internal {
0168     template <class> struct nullopt_holder {
0169       static const nullopt_t instance_;
0170     };
0171     template<class Dummy>
0172     const nullopt_t nullopt_holder<Dummy>::instance_  = nullopt_t(0);
0173   }
0174   static const nullopt_t &nullopt = internal::nullopt_holder<void>::instance_;
0175 
0176 #endif
0177 
0178 template<class T>
0179 class Optional FLATBUFFERS_FINAL_CLASS {
0180   // Non-scalar 'T' would extremely complicated Optional<T>.
0181   // Use is_scalar<T> checking because flatbuffers flatbuffers::is_arithmetic<T>
0182   // isn't implemented.
0183   static_assert(flatbuffers::is_scalar<T>::value, "unexpected type T");
0184 
0185  public:
0186   ~Optional() {}
0187 
0188   FLATBUFFERS_CONSTEXPR_CPP11 Optional() FLATBUFFERS_NOEXCEPT
0189     : value_(), has_value_(false) {}
0190 
0191   FLATBUFFERS_CONSTEXPR_CPP11 Optional(nullopt_t) FLATBUFFERS_NOEXCEPT
0192     : value_(), has_value_(false) {}
0193 
0194   FLATBUFFERS_CONSTEXPR_CPP11 Optional(T val) FLATBUFFERS_NOEXCEPT
0195     : value_(val), has_value_(true) {}
0196 
0197   FLATBUFFERS_CONSTEXPR_CPP11 Optional(const Optional &other) FLATBUFFERS_NOEXCEPT
0198     : value_(other.value_), has_value_(other.has_value_) {}
0199 
0200   FLATBUFFERS_CONSTEXPR_CPP14 Optional &operator=(const Optional &other) FLATBUFFERS_NOEXCEPT {
0201     value_ = other.value_;
0202     has_value_ = other.has_value_;
0203     return *this;
0204   }
0205 
0206   FLATBUFFERS_CONSTEXPR_CPP14 Optional &operator=(nullopt_t) FLATBUFFERS_NOEXCEPT {
0207     value_ = T();
0208     has_value_ = false;
0209     return *this;
0210   }
0211 
0212   FLATBUFFERS_CONSTEXPR_CPP14 Optional &operator=(T val) FLATBUFFERS_NOEXCEPT {
0213     value_ = val;
0214     has_value_ = true;
0215     return *this;
0216   }
0217 
0218   void reset() FLATBUFFERS_NOEXCEPT {
0219     *this = nullopt;
0220   }
0221 
0222   void swap(Optional &other) FLATBUFFERS_NOEXCEPT {
0223     std::swap(value_, other.value_);
0224     std::swap(has_value_, other.has_value_);
0225   }
0226 
0227   FLATBUFFERS_CONSTEXPR_CPP11 FLATBUFFERS_EXPLICIT_CPP11 operator bool() const FLATBUFFERS_NOEXCEPT {
0228     return has_value_;
0229   }
0230 
0231   FLATBUFFERS_CONSTEXPR_CPP11 bool has_value() const FLATBUFFERS_NOEXCEPT {
0232     return has_value_;
0233   }
0234 
0235   FLATBUFFERS_CONSTEXPR_CPP11 const T& operator*() const FLATBUFFERS_NOEXCEPT {
0236     return value_;
0237   }
0238 
0239   const T& value() const {
0240     FLATBUFFERS_ASSERT(has_value());
0241     return value_;
0242   }
0243 
0244   T value_or(T default_value) const FLATBUFFERS_NOEXCEPT {
0245     return has_value() ? value_ : default_value;
0246   }
0247 
0248  private:
0249   T value_;
0250   bool has_value_;
0251 };
0252 
0253 template<class T>
0254 FLATBUFFERS_CONSTEXPR_CPP11 bool operator==(const Optional<T>& opt, nullopt_t) FLATBUFFERS_NOEXCEPT {
0255   return !opt;
0256 }
0257 template<class T>
0258 FLATBUFFERS_CONSTEXPR_CPP11 bool operator==(nullopt_t, const Optional<T>& opt) FLATBUFFERS_NOEXCEPT {
0259   return !opt;
0260 }
0261 
0262 template<class T, class U>
0263 FLATBUFFERS_CONSTEXPR_CPP11 bool operator==(const Optional<T>& lhs, const U& rhs) FLATBUFFERS_NOEXCEPT {
0264   return static_cast<bool>(lhs) && (*lhs == rhs);
0265 }
0266 
0267 template<class T, class U>
0268 FLATBUFFERS_CONSTEXPR_CPP11 bool operator==(const T& lhs, const Optional<U>& rhs) FLATBUFFERS_NOEXCEPT {
0269   return static_cast<bool>(rhs) && (lhs == *rhs);
0270 }
0271 
0272 template<class T, class U>
0273 FLATBUFFERS_CONSTEXPR_CPP11 bool operator==(const Optional<T>& lhs, const Optional<U>& rhs) FLATBUFFERS_NOEXCEPT {
0274   return static_cast<bool>(lhs) != static_cast<bool>(rhs)
0275               ? false
0276               : !static_cast<bool>(lhs) ? true : (*lhs == *rhs);
0277 }
0278 #endif // FLATBUFFERS_USE_STD_OPTIONAL
0279 
0280 
0281 // Very limited and naive partial implementation of C++20 std::span<T,Extent>.
0282 #if defined(FLATBUFFERS_USE_STD_SPAN)
0283   inline constexpr std::size_t dynamic_extent = std::dynamic_extent;
0284   template<class T, std::size_t Extent = std::dynamic_extent>
0285   using span = std::span<T, Extent>;
0286 
0287 #else // !defined(FLATBUFFERS_USE_STD_SPAN)
0288 FLATBUFFERS_CONSTEXPR std::size_t dynamic_extent = static_cast<std::size_t>(-1);
0289 
0290 // Exclude this code if MSVC2010 or non-STL Android is active.
0291 // The non-STL Android doesn't have `std::is_convertible` required for SFINAE.
0292 #if !defined(FLATBUFFERS_SPAN_MINIMAL)
0293 namespace internal {
0294   // This is SFINAE helper class for checking of a common condition:
0295   // > This overload only participates in overload resolution
0296   // > Check whether a pointer to an array of From can be converted
0297   // > to a pointer to an array of To.
0298   // This helper is used for checking of 'From -> const From'.
0299   template<class To, std::size_t Extent, class From, std::size_t N>
0300   struct is_span_convertible {
0301     using type =
0302       typename std::conditional<std::is_convertible<From (*)[], To (*)[]>::value
0303                                 && (Extent == dynamic_extent || N == Extent),
0304                                 int, void>::type;
0305   };
0306 
0307   template<typename T>
0308   struct SpanIterator {
0309     // TODO: upgrade to std::random_access_iterator_tag.
0310     using iterator_category = std::forward_iterator_tag;
0311     using difference_type  = std::ptrdiff_t;
0312     using value_type = typename std::remove_cv<T>::type;
0313     using reference = T&;
0314     using pointer   = T*;
0315 
0316     // Convince MSVC compiler that this iterator is trusted (it is verified).
0317     #ifdef _MSC_VER
0318       using _Unchecked_type = pointer;
0319     #endif // _MSC_VER
0320 
0321     SpanIterator(pointer ptr) : ptr_(ptr) {}
0322     reference operator*() const { return *ptr_; }
0323     pointer operator->() { return ptr_; }
0324     SpanIterator& operator++() { ptr_++; return *this; }  
0325     SpanIterator  operator++(int) { auto tmp = *this; ++(*this); return tmp; }
0326 
0327     friend bool operator== (const SpanIterator& lhs, const SpanIterator& rhs) { return lhs.ptr_ == rhs.ptr_; }
0328     friend bool operator!= (const SpanIterator& lhs, const SpanIterator& rhs) { return lhs.ptr_ != rhs.ptr_; }
0329 
0330    private:
0331     pointer ptr_;
0332   };
0333 }  // namespace internal
0334 #endif  // !defined(FLATBUFFERS_SPAN_MINIMAL)
0335 
0336 // T - element type; must be a complete type that is not an abstract
0337 // class type.
0338 // Extent - the number of elements in the sequence, or dynamic.
0339 template<class T, std::size_t Extent = dynamic_extent>
0340 class span FLATBUFFERS_FINAL_CLASS {
0341  public:
0342   typedef T element_type;
0343   typedef T& reference;
0344   typedef const T& const_reference;
0345   typedef T* pointer;
0346   typedef const T* const_pointer;
0347   typedef std::size_t size_type;
0348 
0349   static FLATBUFFERS_CONSTEXPR size_type extent = Extent;
0350 
0351   // Returns the number of elements in the span.
0352   FLATBUFFERS_CONSTEXPR_CPP11 size_type size() const FLATBUFFERS_NOEXCEPT {
0353     return count_;
0354   }
0355 
0356   // Returns the size of the sequence in bytes.
0357   FLATBUFFERS_CONSTEXPR_CPP11
0358   size_type size_bytes() const FLATBUFFERS_NOEXCEPT {
0359     return size() * sizeof(element_type);
0360   }
0361 
0362   // Checks if the span is empty.
0363   FLATBUFFERS_CONSTEXPR_CPP11 bool empty() const FLATBUFFERS_NOEXCEPT {
0364     return size() == 0;
0365   }
0366 
0367   // Returns a pointer to the beginning of the sequence.
0368   FLATBUFFERS_CONSTEXPR_CPP11 pointer data() const FLATBUFFERS_NOEXCEPT {
0369     return data_;
0370   }
0371 
0372   #if !defined(FLATBUFFERS_SPAN_MINIMAL)
0373     using Iterator = internal::SpanIterator<T>;
0374 
0375     Iterator begin() const { return Iterator(data()); }
0376     Iterator end() const   { return Iterator(data() + size()); }
0377   #endif
0378 
0379   // Returns a reference to the idx-th element of the sequence.
0380   // The behavior is undefined if the idx is greater than or equal to size().
0381   FLATBUFFERS_CONSTEXPR_CPP11 reference operator[](size_type idx) const {
0382     return data()[idx];
0383   }
0384 
0385   FLATBUFFERS_CONSTEXPR_CPP11 span(const span &other) FLATBUFFERS_NOEXCEPT
0386       : data_(other.data_), count_(other.count_) {}
0387 
0388   FLATBUFFERS_CONSTEXPR_CPP14 span &operator=(const span &other)
0389       FLATBUFFERS_NOEXCEPT {
0390     data_ = other.data_;
0391     count_ = other.count_;
0392   }
0393 
0394   // Limited implementation of
0395   // `template <class It> constexpr std::span(It first, size_type count);`.
0396   //
0397   // Constructs a span that is a view over the range [first, first + count);
0398   // the resulting span has: data() == first and size() == count.
0399   // The behavior is undefined if [first, first + count) is not a valid range,
0400   // or if (extent != flatbuffers::dynamic_extent && count != extent).
0401   FLATBUFFERS_CONSTEXPR_CPP11
0402   explicit span(pointer first, size_type count) FLATBUFFERS_NOEXCEPT
0403     : data_ (Extent == dynamic_extent ? first : (Extent == count ? first : nullptr)),
0404       count_(Extent == dynamic_extent ? count : (Extent == count ? Extent : 0)) {
0405       // Make span empty if the count argument is incompatible with span<T,N>.
0406   }
0407 
0408   // Exclude this code if MSVC2010 is active. The MSVC2010 isn't C++11
0409   // compliant, it doesn't support default template arguments for functions.
0410   #if defined(FLATBUFFERS_SPAN_MINIMAL)
0411   FLATBUFFERS_CONSTEXPR_CPP11 span() FLATBUFFERS_NOEXCEPT : data_(nullptr),
0412                                                             count_(0) {
0413     static_assert(extent == 0 || extent == dynamic_extent, "invalid span");
0414   }
0415 
0416   #else
0417   // Constructs an empty span whose data() == nullptr and size() == 0.
0418   // This overload only participates in overload resolution if
0419   // extent == 0 || extent == flatbuffers::dynamic_extent.
0420   // A dummy template argument N is need dependency for SFINAE.
0421   template<std::size_t N = 0,
0422     typename internal::is_span_convertible<element_type, Extent, element_type, (N - N)>::type = 0>
0423   FLATBUFFERS_CONSTEXPR_CPP11 span() FLATBUFFERS_NOEXCEPT : data_(nullptr),
0424                                                             count_(0) {
0425     static_assert(extent == 0 || extent == dynamic_extent, "invalid span");
0426   }
0427 
0428   // Constructs a span that is a view over the array arr; the resulting span
0429   // has size() == N and data() == std::data(arr). These overloads only
0430   // participate in overload resolution if
0431   // extent == std::dynamic_extent || N == extent is true and
0432   // std::remove_pointer_t<decltype(std::data(arr))>(*)[]
0433   // is convertible to element_type (*)[].
0434   template<std::size_t N,
0435     typename internal::is_span_convertible<element_type, Extent, element_type, N>::type = 0>
0436   FLATBUFFERS_CONSTEXPR_CPP11 span(element_type (&arr)[N]) FLATBUFFERS_NOEXCEPT
0437       : data_(arr), count_(N) {}
0438 
0439   template<class U, std::size_t N,
0440     typename internal::is_span_convertible<element_type, Extent, U, N>::type = 0>
0441   FLATBUFFERS_CONSTEXPR_CPP11 span(std::array<U, N> &arr) FLATBUFFERS_NOEXCEPT
0442      : data_(arr.data()), count_(N) {}
0443 
0444   //template<class U, std::size_t N,
0445   //  int = 0>
0446   //FLATBUFFERS_CONSTEXPR_CPP11 span(std::array<U, N> &arr) FLATBUFFERS_NOEXCEPT
0447   //   : data_(arr.data()), count_(N) {}
0448 
0449   template<class U, std::size_t N,
0450     typename internal::is_span_convertible<element_type, Extent, U, N>::type = 0>
0451   FLATBUFFERS_CONSTEXPR_CPP11 span(const std::array<U, N> &arr) FLATBUFFERS_NOEXCEPT
0452     : data_(arr.data()), count_(N) {}
0453 
0454   // Converting constructor from another span s;
0455   // the resulting span has size() == s.size() and data() == s.data().
0456   // This overload only participates in overload resolution
0457   // if extent == std::dynamic_extent || N == extent is true and U (*)[]
0458   // is convertible to element_type (*)[].
0459   template<class U, std::size_t N,
0460     typename internal::is_span_convertible<element_type, Extent, U, N>::type = 0>
0461   FLATBUFFERS_CONSTEXPR_CPP11 span(const flatbuffers::span<U, N> &s) FLATBUFFERS_NOEXCEPT
0462       : span(s.data(), s.size()) {
0463   }
0464 
0465   #endif  // !defined(FLATBUFFERS_SPAN_MINIMAL)
0466 
0467  private:
0468   // This is a naive implementation with 'count_' member even if (Extent != dynamic_extent).
0469   pointer const data_;
0470   size_type count_;
0471 };
0472 #endif  // defined(FLATBUFFERS_USE_STD_SPAN)
0473 
0474 #if !defined(FLATBUFFERS_SPAN_MINIMAL)
0475 template<class ElementType, std::size_t Extent>
0476 FLATBUFFERS_CONSTEXPR_CPP11
0477 flatbuffers::span<ElementType, Extent> make_span(ElementType(&arr)[Extent]) FLATBUFFERS_NOEXCEPT {
0478   return span<ElementType, Extent>(arr);
0479 }
0480 
0481 template<class ElementType, std::size_t Extent>
0482 FLATBUFFERS_CONSTEXPR_CPP11
0483 flatbuffers::span<const ElementType, Extent> make_span(const ElementType(&arr)[Extent]) FLATBUFFERS_NOEXCEPT {
0484   return span<const ElementType, Extent>(arr);
0485 }
0486 
0487 template<class ElementType, std::size_t Extent>
0488 FLATBUFFERS_CONSTEXPR_CPP11
0489 flatbuffers::span<ElementType, Extent> make_span(std::array<ElementType, Extent> &arr) FLATBUFFERS_NOEXCEPT {
0490   return span<ElementType, Extent>(arr);
0491 }
0492 
0493 template<class ElementType, std::size_t Extent>
0494 FLATBUFFERS_CONSTEXPR_CPP11
0495 flatbuffers::span<const ElementType, Extent> make_span(const std::array<ElementType, Extent> &arr) FLATBUFFERS_NOEXCEPT {
0496   return span<const ElementType, Extent>(arr);
0497 }
0498 
0499 template<class ElementType, std::size_t Extent>
0500 FLATBUFFERS_CONSTEXPR_CPP11
0501 flatbuffers::span<ElementType, dynamic_extent> make_span(ElementType *first, std::size_t count) FLATBUFFERS_NOEXCEPT {
0502   return span<ElementType, dynamic_extent>(first, count);
0503 }
0504 
0505 template<class ElementType, std::size_t Extent>
0506 FLATBUFFERS_CONSTEXPR_CPP11
0507 flatbuffers::span<const ElementType, dynamic_extent> make_span(const ElementType *first, std::size_t count) FLATBUFFERS_NOEXCEPT {
0508   return span<const ElementType, dynamic_extent>(first, count);
0509 }
0510 #endif // !defined(FLATBUFFERS_SPAN_MINIMAL)
0511 
0512 }  // namespace flatbuffers
0513 
0514 #endif  // FLATBUFFERS_STL_EMULATION_H_