diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
@@ -1,24 +1,33 @@ #include "vector.hpp" +#include <vector> #include <iostream> +#include <algorithm> + +using namespace ft; + +void print(const int& n) +{ + std::cout << n << std::endl; +} int main() { - ft::vector<int> vec(10); - ft::vector<int> other(vec); + vector<int> vec(10); + vector<int> other(vec); vec = other; - std::cout << (vec == other) << std::endl; - other.assign(ft::vector<int>::size_type(5), 3); - for (ft::vector<int>::size_type i = 0; i < other.size(); i++) - std::cout << other.at(i) << std::endl; - std::cout << std::endl; + other.assign(vector<int>::size_type(5), 3); other.push_back(6); other.push_back(8); - for (ft::vector<int>::size_type i = 0; i < other.size(); i++) - std::cout << other.at(i) << std::endl; + std::for_each(other.begin(), other.end(), print); + std::cout << std::endl; + const vector<int> constvec(other); + std::for_each(constvec.rbegin(), constvec.rend(), print); std::cout << std::endl; other.pop_back(); - for (ft::vector<int>::size_type i = 0; i < other.size(); i++) - std::cout << other.at(i) << std::endl; + std::for_each(other.begin(), other.end(), print); + std::cout << std::endl; + std::cout << "comparaisons" << std::endl; + std::cout << (vec == other) << std::endl; std::cout << (vec == other) << std::endl; return 0; } |