-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicIntArray.h
More file actions
51 lines (41 loc) · 1.35 KB
/
DynamicIntArray.h
File metadata and controls
51 lines (41 loc) · 1.35 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
// ===========================================================================
// DynamicIntArray.h
// ===========================================================================
#pragma once
#include <iostream>
class DynamicIntArray
{
private:
int* m_data;
size_t m_size;
public:
// c'tor(s) / d'tor
DynamicIntArray();
DynamicIntArray(size_t size);
DynamicIntArray(int* values, size_t count);
~DynamicIntArray();
// getter / setter
size_t size() const;
int& at(size_t index);
// public interface
void fill(int value);
void resize(size_t newSize);
void shrinkToFit();
int minimum() const;
int maximum() const;
int indexOf(int value) const;
bool contains(int value) const;
void release();
void print() const;
// operators
int& operator[] (size_t index);
// copy semantics
DynamicIntArray(const DynamicIntArray&); // copy c'tor
DynamicIntArray& operator= (const DynamicIntArray&); // copy assignment
// comparison operators
friend bool operator== (const DynamicIntArray& left, DynamicIntArray right);
friend bool operator!= (const DynamicIntArray& left, DynamicIntArray right);
};
// ===========================================================================
// End-of-File
// ===========================================================================