Skip to main content

📐 Resize

Changes the array size.

Methods that return pointers allow chained calls.

MovingAveragePlus<unsigned int> intAverage(10);

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

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

📝 Syntax

MovingAveragePlus<TypeOfArray> &resize(size_t new_size)

🔮 Example

MovingAveragePlus<unsigned int> intAverage(3);

// 3 2 1
intAverage.push(1).push(2).push(3);

// 3 2 1 0 0
intAverage.resize(5);

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

⏱ Complexity

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