summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kdx.42@42l.fr>2023-01-11 02:56:49 +0100
committerkdx <kdx.42@42l.fr>2023-01-11 02:56:49 +0100
commit15f24ce4fcf9a8038a3035574d241760644a4ea7 (patch)
tree6e3ac2d6716baa19151f1bb4e9570f9627e2a71c
parent1eaf09c20a0938b5dce6cac60df545a4d13b37e3 (diff)
download42-containers-15f24ce4fcf9a8038a3035574d241760644a4ea7.tar.gz
header. fuck.
-rw-r--r--.gitignore2
-rw-r--r--vector.hpp98
2 files changed, 95 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d7756c2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+a.out
+*.o
diff --git a/vector.hpp b/vector.hpp
index ca3ff98..89c9bc2 100644
--- a/vector.hpp
+++ b/vector.hpp
@@ -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);
}
+