Class SeqBaseObj#

Inheritance Relationships#

Base Types#

Derived Types#

Class Documentation#

class SeqBaseObj : public tvm::ffi::Object, protected TVMFFISeqCell#

Base class for sequence containers (ArrayObj, ListObj).

SeqBaseObj is transparent to the FFI type system (no type index), following the same pattern as BytesObjBase.

Subclassed by tvm::ffi::ArrayObj, tvm::ffi::ListObj

Public Functions

inline SeqBaseObj()#
inline ~SeqBaseObj()#
inline size_t size() const#
Returns:

The size of the sequence

inline size_t capacity() const#
Returns:

The capacity of the sequence

inline bool empty() const#
Returns:

Whether the sequence is empty

inline const Any &at(int64_t i) const#

Read i-th element from the sequence.

Parameters:

i – The index

Returns:

the i-th element.

inline const Any &front() const#
Returns:

The first element

inline const Any &back() const#
Returns:

The last element

inline const Any *begin() const#
Returns:

begin constant iterator

inline const Any *end() const#
Returns:

end constant iterator

inline void clear()#

Release reference to all the elements.

inline void SetItem(int64_t i, Any item)#

Set i-th element of the sequence in-place.

Parameters:
  • i – The index

  • item – The value to be set

inline void pop_back()#

Remove the last element.

inline void erase(int64_t idx)#

Erase element at position idx.

Parameters:

idx – The index to erase

inline void erase(int64_t first, int64_t last)#

Erase elements in half-open range [first, last)

Parameters:
  • first – Start index (inclusive)

  • last – End index (exclusive)

inline void insert(int64_t idx, Any item)#

Insert element at position idx.

Note

Caller must ensure capacity >= size + 1

Parameters:
  • idx – The index to insert at

  • item – The value to insert

template<typename IterType>
inline void insert(int64_t idx, IterType first, IterType last)#

Insert elements from iterator range at position idx.

Note

Caller must ensure capacity >= size + distance(first, last)

Parameters:
  • idx – The index to insert at

  • first – Begin of iterator

  • last – End of iterator

Template Parameters:

IterType – The type of iterator

inline void Reverse()#

Reverse the elements in-place.

inline void resize(int64_t n)#

Resize the sequence.

Note

Caller must ensure capacity >= n when growing

Parameters:

n – The new size