diff options
Diffstat (limited to 'vector.hpp')
-rw-r--r-- | vector.hpp | 98 |
1 files changed, 93 insertions, 5 deletions
@@ -14,14 +14,102 @@ namespace ft { typedef value_type& reference; typedef const value_type& const_reference; typedef typename Allocator::pointer pointer; - typedef void iterator; - typedef void const_iterator; - typedef void reverse_iterator; - typedef void const_reverse_iterator; + /* 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, ); + 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); } + |