Template Class Tuple#

Inheritance Relationships#

Base Type#

Class Documentation#

template<typename ...Types>
class Tuple : public tvm::ffi::ObjectRef#

Typed tuple like std::tuple backed by ArrayObj container.

Tuple implements in-place copy-on-write semantics.

Template Parameters:

Types – The types of the tuple elements

Public Types

using ContainerType = ArrayObj#

specify container node

Public Functions

inline Tuple()#

Default constructor.

inline explicit Tuple(UnsafeInit tag)#

Constructor with UnsafeInit.

inline Tuple(const Tuple<Types...> &other)#

Copy constructor.

inline Tuple(Tuple<Types...> &&other)#

Move constructor.

template<typename ...UTypes, typename = std::enable_if_t<(details::type_contains_v<Types, UTypes> && ...), int>>
inline Tuple(const Tuple<UTypes...> &other)#

Constructor from another tuple.

Parameters:

other – The other tuple

Template Parameters:
  • UTypes – The types of the other tuple

  • The – enable_if_t type

template<typename ...UTypes, typename = std::enable_if_t<(details::type_contains_v<Types, UTypes> && ...), int>>
inline Tuple(Tuple<UTypes...> &&other)#

Constructor from another tuple.

Parameters:

other – The other tuple

Template Parameters:
  • UTypes – The types of the other tuple

  • The – enable_if_t type

template<typename ...UTypes, typename = std::enable_if_t<sizeof...(Types) == sizeof...(UTypes) && !(sizeof...(Types) == 1 && (std::is_same_v<std::decay_t<UTypes>, Tuple<Types>> && ...))>>
inline explicit Tuple(UTypes&&... args)#

Constructor from arguments.

Parameters:

args – The arguments

Template Parameters:

UTypes – The types of the other tuple

template<size_t I>
inline auto get() const#

Get I-th element of the tuple.

Note

We use stl style since get usually is like a getter.

Template Parameters:

I – The index of the element to get

Returns:

The I-th element of the tuple

template<size_t I, typename U>
inline void Set(U &&item)#

Set I-th element of the tuple.

Note

This function will perform copy on write if underlying container is not uniquely owned. We use CamelCase since Set can cause copy on write and is more complicated than simple field setter.

Parameters:

item – The item to set

Template Parameters:
  • I – The index of the element to set

  • U – The type of the item