38 lines
573 B
C++
38 lines
573 B
C++
#ifndef SPAN_HPP
|
|
#define SPAN_HPP
|
|
|
|
#include <algorithm>
|
|
#include <iostream>
|
|
#include <limits>
|
|
#include <stdexcept>
|
|
#include <vector>
|
|
|
|
class Span
|
|
{
|
|
private:
|
|
unsigned int _n;
|
|
std::vector<int> _vec;
|
|
|
|
public:
|
|
Span();
|
|
Span(const unsigned int n);
|
|
~Span();
|
|
Span(const Span& other);
|
|
Span &operator=(const Span& other);
|
|
|
|
int shortestSpan() const;
|
|
int longestSpan() const;
|
|
void addNumber(int x);
|
|
|
|
template <typename Iterator>
|
|
void addNumber(Iterator begin, Iterator end)
|
|
{
|
|
while (begin != end) {
|
|
addNumber(*begin);
|
|
begin++;
|
|
}
|
|
}
|
|
};
|
|
|
|
#endif
|