vector finish
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
#ifndef VECTOR_HPP
|
||||
# define VECTOR_HPP
|
||||
|
||||
# include "colors.h"
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
# include <memory> // std::allocator
|
||||
# include <algorithm> // std::min
|
||||
# include <algorithm> // std::min, std::max
|
||||
# include <stdexcept> // out_of_range, length_error, logic_error
|
||||
# include <cstddef> // NULL, size_t, ptrdiff_t
|
||||
# include <cstddef> // NULL, std::size_t, std::ptrdiff_t
|
||||
|
||||
# include "colors.h"
|
||||
# include "enable_if.hpp"
|
||||
# include "is_integral.hpp"
|
||||
# include "reverse_iterator.hpp"
|
||||
# include "equal.hpp"
|
||||
# include "lexicographical_compare.hpp"
|
||||
|
||||
namespace ft {
|
||||
|
||||
@@ -28,15 +31,13 @@ public:
|
||||
|
||||
typedef T * iterator;
|
||||
typedef T const * const_iterator;
|
||||
// typedef ft::reverse_iterator<iterator> reverse_iterator;
|
||||
// typedef ft::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef ft::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef ft::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// dependent qualified name :
|
||||
// https://en.cppreference.com/w/cpp/keyword/typename
|
||||
typedef typename Allocator::reference reference;
|
||||
typedef typename Allocator::const_reference const_reference;
|
||||
// typedef typename Allocator::pointer pointer;
|
||||
// typedef typename Allocator::const_pointer const_pointer;
|
||||
|
||||
|
||||
|
||||
@@ -67,11 +68,12 @@ public:
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
// rbegin ------------------------------------
|
||||
// reverse_iterator rbegin();
|
||||
// const_reverse_iterator rbegin() const;
|
||||
reverse_iterator rbegin();
|
||||
const_reverse_iterator rbegin() const;
|
||||
// rend --------------------------------------
|
||||
// reverse_iterator rend();
|
||||
// const_reverse_iterator rend() const;
|
||||
reverse_iterator rend();
|
||||
const_reverse_iterator rend() const;
|
||||
|
||||
|
||||
/************
|
||||
* capacity :
|
||||
@@ -89,6 +91,7 @@ public:
|
||||
// reserve -----------------------------------
|
||||
void reserve(size_type n);
|
||||
|
||||
|
||||
/******************
|
||||
* element access :
|
||||
******************/
|
||||
@@ -105,6 +108,7 @@ public:
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
|
||||
/*************
|
||||
* modifiers :
|
||||
*************/
|
||||
@@ -131,13 +135,13 @@ public:
|
||||
// clear -------------------------------------
|
||||
void clear();
|
||||
|
||||
|
||||
/*************
|
||||
* allocator :
|
||||
*************/
|
||||
// get_allocator -----------------------------
|
||||
allocator_type get_allocator() const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
size_type _size;
|
||||
@@ -150,7 +154,32 @@ private:
|
||||
|
||||
};
|
||||
|
||||
//std::ostream & operator<<(std::ostream & o, vector const & rhs);
|
||||
|
||||
/************************
|
||||
* non-member functions :
|
||||
************************/
|
||||
// operator == -------------------------------
|
||||
template <class T, class Alloc>
|
||||
bool operator== (const vector<T,Alloc>& lhs, const vector<T,Alloc>& rhs);
|
||||
// operator != -------------------------------
|
||||
template <class T, class Alloc>
|
||||
bool operator!= (const vector<T,Alloc>& lhs, const vector<T,Alloc>& rhs);
|
||||
// operator < --------------------------------
|
||||
template <class T, class Alloc>
|
||||
bool operator< (const vector<T,Alloc>& lhs, const vector<T,Alloc>& rhs);
|
||||
// operator <= -------------------------------
|
||||
template <class T, class Alloc>
|
||||
bool operator<= (const vector<T,Alloc>& lhs, const vector<T,Alloc>& rhs);
|
||||
// operator > --------------------------------
|
||||
template <class T, class Alloc>
|
||||
bool operator> (const vector<T,Alloc>& lhs, const vector<T,Alloc>& rhs);
|
||||
// operator >= -------------------------------
|
||||
template <class T, class Alloc>
|
||||
bool operator>= (const vector<T,Alloc>& lhs, const vector<T,Alloc>& rhs);
|
||||
// swap (vector) -----------------------------
|
||||
template <class T, class Alloc>
|
||||
void swap (vector<T,Alloc>& x, vector<T,Alloc>& y);
|
||||
|
||||
|
||||
} // namespace ft
|
||||
|
||||
|
||||
Reference in New Issue
Block a user