Website Summary Files Commits Branches @commit @diff @stats
path: root / src / List / List.h
blob: 377cbf0c9bac5ba301660078965911ea18285348 (plain) (blame)
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
#ifndef HEADER_LIST
#define HEADER_LIST

#include "istream"
#include "ostream"

template <class T>
class List {
	T* elements;
	unsigned length;
	unsigned count;

	void resize();
	void free();
	void copyFrom(const List& other);

public:
	List(const T* elements, unsigned elementsCount);
	void add(const T& element);
	bool removeAt(unsigned index);
	T& operator[](unsigned index);
	const T& operator[](unsigned index) const;

	std::istream& read(std::istream& istr);
	std::ostream& write(std::ostream& ostr) const;

	unsigned get_length() const;
	unsigned get_count() const;

	List();
	List& operator=(const List& other);
	List(const List& other);
	~List();

	List(List&& other);
	List& operator=(List&& other);
};

#endif