-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray_Base.h
More file actions
44 lines (38 loc) · 1.03 KB
/
Copy pathArray_Base.h
File metadata and controls
44 lines (38 loc) · 1.03 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
// Honor Pledge: ashstrin
//
// I pledge that I have neither given nor receieved any help
// on this assignment.
#ifndef _CS507_ARRAY_BASE_H_
#define _CS507_ARRAY_BASE_H_
#include <cstring>
template <typename T>
class Array_Base{
public:
typedef T type;
Array_Base(void);
Array_Base(size_t length);
Array_Base(size_t length, T fill);
Array_Base(const Array_Base & arr);
~Array_Base(void);
const Array_Base & operator = (const Array_Base & rhs);
size_t size(void) const;
size_t max_size(void) const;
T & operator [] (size_t index);
const T & operator [] (size_t index) const;
T get(size_t index) const;
void set(size_t index, T value);
int find(T element) const;
int find(T element, size_t start) const;
bool operator == (const Array_Base & rhs) const;
bool operator != (const Array_Base & rhs) const;
void fill(T element);
void reverse(void);
protected:
void swap(int index1, int index2);
T * data_;
size_t cur_size_;
size_t max_size_;
};
#include "Array_Base.inl";
#include "Array_Base.cpp";
#endif