Skip to main content

๐Ÿงน Clear

Clears the average back to 0, ****including its **initial size**.

Methods that return pointers allow chained calls.

DataTomeMvAvg<int> intAverage(10);

int x = 5, y = 10;
int result, first, last;

result = intAverage.push(x).push(y).get();
first = intAverage.push(56).front();
last = intAverage.push(8).back();

๐Ÿ“ Syntaxโ€‹

DataTomeMvAvg<TypeOfArray, TypeOfSum> &clear()

๐Ÿ”ฎ Exampleโ€‹

DataTomeMvAvg<int> intAverage(5);

// 4 3 2 1 0
intAverage.push(1).push(2).push(3).push(4)

// will return 0
intAverage.clear().get()

โฑ Complexityโ€‹

Linear (O(n)) in the array size.