TypedPair-class: A typed pair container similar to C++ std::pair extending the...

Description Fields Note Author(s) Examples

Description

A typed pair container similar to C++ std::pair extending the Pair class

Fields

T1

(character) string specifying the type of the first element

T2

(character) string specifying the type of the second element

Note

Date of last modification: 09.09.2015

Change history: none

Author(s)

Roman Pahl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
x0 <- TypedPair(T1 = "character", first = "x", T2 = "numeric", second = 0)
Analog: Short (implicit) construction
x0 <- TypedPair("character", "x", "numeric", 0)
x0$first # "x"
x0$second # "0"
## Not run: 
x0$setFirst(1) # Throws "bad type - expected character but got numeric"

## End(Not run)
x0$setFirst("z") # ok
x0$first # "z"

y1 <- TypedPair("character", "y", "numeric", 1)
x0$swap(y1)
x0$first # "y"
x0$second # "1"

rpahl/Squash documentation built on May 28, 2019, 12:35 a.m.