# SpecAverageAccumulatorAccumulator for computing averages.

Extends Accumulator Accumulator ```template struct Accumulator; ```

## Template Parameters

`TValue` The type of the values to compute the average of.

## Interface Function Overview

• `TResult average(acc);`
Return the average of the included values.
• `TResult count(acc);`
Return the number of included values.
• `TResult sum(acc);`
Return the sum of the included values.

### Interface Functions Inherited From Accumulator

• `clear`
• `push`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From Accumulator

• `Result`
• `Value`

## Detailed Description

The average of an empty sequence is defined to be 0.

### Examples

This program shows how to use the Average Accumulator.

```Accumulator<int, AccuAverage> acc;
push(acc, 1);
push(acc, 2);
push(acc, 3);
std::cout << "average: " << average(acc) << "\n"
<< "sum:     " << sum(acc) << "\n"
<< "count:   " << count(acc) << "\n";
```

The output is then:

```average: 2
sum:     6
count:   3```

## Interface Functions Detail

### `TResult average(acc);`

Return the average of the included values.

#### Parameters

 `acc` The Accumulator to compute the average for.

#### Returns

`TResult` The average of the values (Metafunction: Result).

### `TResult count(acc);`

Return the number of included values.

#### Parameters

 `count` The number of values pushed to the accumulator.

#### Returns

`TResult` The number of pushed values (Metafunction: Result).

### `TResult sum(acc);`

Return the sum of the included values.

#### Parameters

 `acc` The Accumulator to compute the sum for.

#### Returns

`TResult` The sum of the values (Metafunction: Result).