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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#pragma once
#include <memory>
namespace ft {
template <
class T,
class Allocator = std::allocator<T>
> class vector {
private:
typedef T value_type;
typedef Allocator allocator_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename Allocator::pointer pointer;
/* TODO */
typedef int iterator;
typedef int const_iterator;
typedef int reverse_iterator;
typedef int const_reverse_iterator;
size_type _size;
size_type _capacity;
T *_data;
public:
/* constructor */
vector();
explicit vector(const Allocator& alloc);
explicit vector(size_type count,
const T& value = T(),
const Allocator& alloc = Allocator());
template<class InputIt>
vector(InputIt first, InputIt last,
const Allocator&alloc = Allocator());
vector(const vector& other);
/* destructor */
~vector();
/* operator= */
vector& operator=(const vector& other);
/* assign */
void assign(size_type count, const T& value);
template<class InputIt>
void assign(InputIt first, InputIt last);
/* get_allocator */
allocator_type get_allocator() const;
/* ELEMENT ACCESS */
/* at */
reference at(size_type pos);
const_reference at(size_type pos) const;
/* operator[] */
reference operator[](size_type pos);
const_reference operator[](size_type pos) const;
/* front */
reference front();
const_reference front() const;
/* back */
reference back();
const_reference back() const;
/* data */
T* data();
const T* data() const;
/* ITERATORS TODO */
/* CAPACITY */
bool empty() const;
size_type size() const;
size_type max_size() const;
void reserve(size_type new_cap);
size_type capacity() const;
/* MODIFIERS */
/* clear */
void clear();
/* insert */
void insert();
iterator insert(const_iterator pos, const T& value);
iterator insert(const_iterator pos, size_type count,
const T& value);
template<class InputIt>
iterator insert(const_iterator pos, InputIt first,
InputIt last);
/* erase */
iterator erase(iterator pos);
iterator erase(iterator first, iterator last);
/* push_back */
void push_back(const T& value);
/* pop_back */
void pop_back();
/* resize */
void resize(size_type count);
void resize(size_type count, const value_type& value);
/* swap */
void swap(vector& other);
};
template<class T, class Alloc>
void swap(vector<T,Alloc>& lhs,
vector<T,Alloc>& rhs);
template<class T, class Alloc>
bool operator==(const vector<T,Alloc>& lhs,
const vector<T,Alloc>& rhs);
template<class T, class Alloc>
bool operator!=(const vector<T,Alloc>& lhs,
const vector<T,Alloc>& rhs);
template<class T, class Alloc>
bool operator<(const vector<T,Alloc>& lhs,
const vector<T,Alloc>& rhs);
template<class T, class Alloc>
bool operator<=(const vector<T,Alloc>& lhs,
const vector<T,Alloc>& rhs);
template<class T, class Alloc>
bool operator>(const vector<T,Alloc>& lhs,
const vector<T,Alloc>& rhs);
template<class T, class Alloc>
bool operator>=(const vector<T,Alloc>& lhs,
const vector<T,Alloc>& rhs);
}
|