Tuple

class ampl::Tuple : public ampl::BasicTuple<true>

Represents a tuple with ownership semantics (owns all the data it contains)

Constructors

Constructors for Tuple objects.

inline Tuple()

Construct an empty Tuple.

inline Tuple(Variant arguments[], std::size_t N)

Construct a n-Tuple from an array of variants.

inline explicit Tuple(TupleRef t)

Construct a Tuple from a TupleRef.

Constructors from variants

Constructors from ampl::Variant objects.

inline explicit Tuple(VariantRef v1)
inline Tuple(VariantRef v1, VariantRef v2)
inline Tuple(VariantRef v1, VariantRef v2, VariantRef v3)
inline Tuple(VariantRef v1, VariantRef v2, VariantRef v3, VariantRef v4)

Construct tuples from variants.

Parameters
  • v1 – First element

  • v2 – Second element

  • v3 – Third element

  • v4 – Fourth element

Public Functions

inline explicit Tuple(internal::Tuple other)

Construct a tuple from an internal struct (infrastructure)

inline internal::Tuple impl() const

Get access to the inner immutable object (infrastructure).

inline std::size_t size() const

Get the number of Elements in this tuple.

inline std::string toString() const

Return a string representation of this tuple.

All elements are formatted as in BasicVariant::toString and comma separated. An empty tuple is returned as “()”.

inline VariantRef operator[](std::size_t index) const

Accessor for elements of the tuple.

Public Static Functions

static inline Tuple join(TupleRef t1, TupleRef t2)

Join two tuples together and forms a new one copying all data.

TupleRef

typedef BasicTuple<false> ampl::TupleRef

Not owning Tuple.

A public typedef of BasicTuple without ownership semantics. It can be used both as a return type when the ownership semantics is not needed (e.g. returning a reference to a tuple stored in a container) and as an argument type to provide implicit conversions and reduce the number of required overloads.