blob: 4edf90f5f642b93d1d8cc379e3a901437e1460ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* span.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/15 06:55:07 by charles #+# #+# */
/* Updated: 2020/12/17 14:07:09 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SPAN_HPP
# define SPAN_HPP
# include <algorithm>
class Span
{
public:
Span();
Span(Span const& other);
Span& operator=(Span const& other);
~Span();
Span(unsigned int n);
void addNumber(int x);
template <typename InputIterator>
void addNumber(InputIterator begin, InputIterator end)
{
for (; begin != end; ++begin)
addNumber(*begin);
}
int shortestSpan() const;
int longestSpan() const;
private:
int* m_under;
unsigned int m_size;
unsigned int m_fillIndex;
void setupSpan() const;
};
#endif
|