-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWordSet.h
More file actions
54 lines (43 loc) · 1.32 KB
/
WordSet.h
File metadata and controls
54 lines (43 loc) · 1.32 KB
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
49
50
51
52
53
54
#pragma once
#include "Word.h"
#include <vector>
#include <string>
class WordSet {
private:
std::vector<Word> words;
public:
WordSet() = default;
void addWord(const Word& word);
void readFromFile(const std::string& filename, Alphabet alphabet);
size_t size() const;
class iterator {
private:
std::vector<Word>::iterator it;
public:
iterator(std::vector<Word>::iterator iter);
Word& operator*();
Word* operator->();
iterator& operator++();
iterator operator++(int);
bool operator==(const iterator& other) const;
bool operator!=(const iterator& other) const;
};
class const_iterator {
private:
std::vector<Word>::const_iterator it;
public:
const_iterator(std::vector<Word>::const_iterator iter);
const Word& operator*() const;
const Word* operator->() const;
const_iterator& operator++();
const_iterator operator++(int);
bool operator==(const const_iterator& other) const;
bool operator!=(const const_iterator& other) const;
};
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
const_iterator cbegin() const;
const_iterator cend() const;
};