-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmy_vector.h
More file actions
54 lines (32 loc) · 838 Bytes
/
my_vector.h
File metadata and controls
54 lines (32 loc) · 838 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef MY_UI_VECTOR
#define MY_UI_VECTOR
#include <memory>
#include <vector>
struct ui_vector {
typedef unsigned int ui;
public:
ui_vector();
~ui_vector();
size_t size() const;
bool empty() const;
ui back() const;
ui &back();
void push_back(ui val);
void pop_back();
void clear();
void resize(size_t len);
ui operator[](size_t ind) const;
ui &operator[](size_t ind);
ui_vector &operator=(ui_vector const &other);
friend bool operator==(ui_vector const &a, ui_vector const &b);
private:
union {
std::shared_ptr<std::vector<ui>> big;
ui small;
};
size_t _size;
bool is_big() const;
void check_count();
};
bool operator==(ui_vector const &a, ui_vector const &b);
#endif