array_ref.h#
-
namespace onnx_light
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Defined as empty because onnx-light does not require explicit
__declspec(dllexport)or__attribute__((visibility("default")))annotations — visibility is controlled at the shared-library level. The macro is provided so that vendored ONNX headers that decorate their declarations withONNX_APIcompile without modification.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.-
template<typename T>
class ArrayRef# - #include <array_ref.h>
Represents a non-owning view over a contiguous sequence of elements.
The referenced storage must outlive the ArrayRef instance.
Public Types
-
using size_type = size_t#
Public Functions
-
inline ArrayRef()#
Constructs an empty reference.
-
inline ArrayRef(const T *data, size_t length)#
Constructs a reference from a pointer and explicit length.
-
inline ArrayRef(const T *begin, const T *end)#
Constructs a reference from a half-open pointer range [begin, end).
-
template<typename A>
inline ArrayRef(const std::vector<T, A> &vec)# Constructs an ArrayRef from a vector.
-
template<size_t N>
inline constexpr ArrayRef(const std::array<T, N> &arr)# Constructs an ArrayRef from a fixed-size std::array.
-
template<size_t N>
inline constexpr ArrayRef(const T (&arr)[N])# Constructs an ArrayRef from a C array.
-
inline ArrayRef(const std::initializer_list<T> &vec)#
Constructs an ArrayRef from an initializer list.
-
inline reverse_iterator rbegin() const#
Returns a reverse iterator to the beginning of the reversed range.
-
inline reverse_iterator rend() const#
Returns a reverse iterator to the end of the reversed range.
-
inline bool empty() const#
Returns true if the reference is empty.
-
inline size_t size() const#
Returns the number of elements.
-
inline ArrayRef<T> slice(size_t n, size_t m) const#
Returns a sub-reference starting at n with length m. Precondition: n + m <= size().
-
inline ArrayRef<T> slice(size_t n) const#
Returns a sub-reference starting at n until the end. Precondition: n <= size().
-
inline const T &operator[](size_t index) const#
Returns the element at index. Precondition: index is in range.
-
inline const T &at(size_t index) const#
Returns the element at index. Precondition: index is in range.
-
template<typename U>
std::enable_if_t<std::is_same_v<U, T>, ArrayRef<T>> &operator=(U &&temporary) = delete#
-
using size_type = size_t#
-
template<typename T>