about summary refs log tree commit diff stats
path: root/histogram.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'histogram.cpp')
-rw-r--r--histogram.cpp10
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
4template <class T> 5template <class T>
5void histogram<T>::add(const T& inst) 6void 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
35template <class T>
36void histogram<T>::print() const
37{
38 for (auto& freqpair : freqtable)
39 {
40 std::cout << freqpair.first << ": " << freqpair.second << std::endl;
41 }
42}
43
34template class histogram <std::string>; 44template class histogram <std::string>;