Tuple

class Tuple : public ampl::BasicTuple<true>

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

Constructors

Constructors for Tuple objects.

Tuple()

Construct an empty Tuple.

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

Construct a n-Tuple from an array of variants.

Tuple(TupleRef t)

Construct a Tuple from a TupleRef.

Constructors from variants

Constructors from ampl::Variant objects.

Tuple(VariantRef v1)
Tuple(VariantRef v1, VariantRef v2)
Tuple(VariantRef v1, VariantRef v2, VariantRef v3)
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

Tuple(internal::Tuple other)

Construct a tuple from an internal struct (infrastructure)

internal::Tuple impl() const

Get access to the inner immutable object (infrastructure).

std::size_t size() const

Get the number of Elements in this tuple.

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 “()”.

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

Accessor for elements of the tuple.

Public Static Functions

static 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.