-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntStream.h
More file actions
33 lines (29 loc) · 946 Bytes
/
IntStream.h
File metadata and controls
33 lines (29 loc) · 946 Bytes
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
/*
Author: Greg Blodgett
The int specialization of the BaseStream Class
*/
#pragma once
#include "BaseStream.h"
#include<vector>
#include<functional>
#include<optional>
class IntStream : public BaseStream<int> {
public:
IntStream(std::vector<int> const&);
IntStream operator = (IntStream const&);
IntStream(const IntStream&);
const int* toArray() const;
int count() const;
static IntStream range(int, int);
IntStream filter(std::function<bool(const int&)>) const;
bool noneMatch(std::function<bool(const int&)>) const;
bool anyMatch(std::function<bool(const int&)>) const;
bool allMatch(std::function<bool(const int&)>) const;
std::optional<int> max() const;
std::optional<int> min() const;
std::optional<int> findFirst(std::function<bool(const int&)>) const;
void forEach(std::function<void(const int&)>) const;
static IntStream of(int args...);
private:
const std::vector<int> elements;
};