map pair ok

This commit is contained in:
hugogogo
2022-06-20 15:40:35 +02:00
parent 8a404b0839
commit 8c181b6407
7 changed files with 287 additions and 67 deletions

View File

@@ -20,6 +20,7 @@
namespace ft = std;
#else
#include "vector.hpp"
#include "map.hpp"
#include "reverse_iterator.hpp"
#endif
@@ -82,9 +83,6 @@ extern std::vector< mystruct* > mem_list;
{ void func(); };\
void f_name () {\
add_to_list(#f_name, "int, int", new(s_ ## f_name <int, int>));\
add_to_list("", "char, int", new(s_ ## f_name <char, int>));\
add_to_list("", "std::string, int", new(s_ ## f_name <std::string, int>));\
add_to_list("", "mystruct*, int", new(s_ ## f_name <mystruct*, int>));\
}\
template <class T, class U>\
void s_ ## f_name <T, U>::func()
@@ -104,15 +102,15 @@ template <class T>
std::cout << "\nsize:" << vec.size() << " capacty:" << vec.capacity() << "\n";
}
template <class T, class U>
void print(ft::map<T, U> ma) {
void print(ft::map<T, U> mp) {
int i = 0;
typename ft::map<T, U>::iterator it;
typename ft::map<T, U>::iterator it_end = ma.end();
typename ft::map<T, U>::iterator it_end = mp.end();
for (it = ma.begin(); it != it_end; ++it, i++)
for (it = mp.begin(); it != it_end; ++it, i++)
std::cout << "[" << i << "]" << it->first << ":" << it->second << " ";
std::cout << "\nsize:" << ma.size() << "\n";
std::cout << "\nsize:" << mp.size() << "\n";
}
// templates get value