diff options
Diffstat (limited to 'histogram.cpp')
| -rw-r--r-- | histogram.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
| diff --git a/histogram.cpp b/histogram.cpp index 6896146..6d31cf4 100644 --- a/histogram.cpp +++ b/histogram.cpp | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include "histogram.h" | 1 | #include "histogram.h" |
| 2 | #include <cstdlib> | 2 | #include <cstdlib> |
| 3 | #include <iostream> | ||
| 3 | 4 | ||
| 4 | template <class T> | 5 | template <class T> |
| 5 | void histogram<T>::add(const T& inst) | 6 | void histogram<T>::add(const T& inst) |
| @@ -31,4 +32,13 @@ const T& histogram<T>::next() const | |||
| 31 | return distribution.upper_bound(r)->second; | 32 | return distribution.upper_bound(r)->second; |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 35 | template <class T> | ||
| 36 | void histogram<T>::print() const | ||
| 37 | { | ||
| 38 | for (auto& freqpair : freqtable) | ||
| 39 | { | ||
| 40 | std::cout << freqpair.first << ": " << freqpair.second << std::endl; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 34 | template class histogram <std::string>; | 44 | template class histogram <std::string>; |
