Skip to content

Triple

Spice
import "std/data/triple";

Triple<V1, V2, V3> struct

A triple in Spice is a commonly used data structure, which saves three values of arbitrary type together in a correlation

Constructors

ctor

Spice
public inline p Triple.ctor(V1 first, V2 second, V3 third)

Construct a triple from three values

Parameters

Name Type Description
first V1 First value
second V2 Second value
third V3 Third value

Methods

getFirst

Spice
public inline f<V1&> Triple.getFirst()

Retrieve the first value of the triple

Returns: V1& — Reference to the first value

getSecond

Spice
public inline f<V2&> Triple.getSecond()

Retrieve the second value of the triple

Returns: V2& — Reference to the second value

getThird

Spice
public inline f<V3&> Triple.getThird()

Retrieve the third value of the triple

Returns: V3& — Reference to the third value

setFirst

Spice
public inline p Triple.setFirst(V1& first)

Set the first value of the triple

Parameters

Name Type Description
first V1& New first value

setSecond

Spice
public inline p Triple.setSecond(V2& second)

Set the second value of the triple

Parameters

Name Type Description
second V2& New second value

setThird

Spice
public inline p Triple.setThird(V3& third)

Set the third value of the triple

Parameters

Name Type Description
third V3& New third value

Operators

operator==

Spice
public f<bool> operator==<V1, V2, V3>(const Triple<V1, V2, V3>& lhs, const Triple<V1, V2, V3>& rhs)

Check if two triples are equal, i.e. all three of their values are equal

Parameters

Name Type Description
lhs const Triple<V1, V2, V3>&
rhs const Triple<V1, V2, V3>&

Returns: bool — Equal or not equal

operator!=

Spice
public f<bool> operator!=<V1, V2, V3>(const Triple<V1, V2, V3>& lhs, const Triple<V1, V2, V3>& rhs)

Check if two triples are not equal

Parameters

Name Type Description
lhs const Triple<V1, V2, V3>&
rhs const Triple<V1, V2, V3>&

Returns: bool — Not equal or equal