makefile really improved on header dependencies

This commit is contained in:
hugogogo
2022-06-29 14:10:17 +02:00
parent 26436c8d8a
commit b0b63d6238
27 changed files with 610 additions and 481 deletions

View File

@@ -11,21 +11,11 @@
#include <utility> // std::make_pair
#include <sstream> // std::stringstream
#include <deque>
// toogle between test ft and stl
// *************************
#include <vector>
#include <map>
#include <stack>
#ifdef STL
namespace ft = std;
#else
#include "vector.hpp"
#include "map.hpp"
#include "stack.hpp"
#include "reverse_iterator.hpp"
#endif
#include "tests_structs.hpp"
// defines
@@ -41,25 +31,6 @@
// prototypes
// *********************************************
// abstract class test -----------------------
struct A_test
{
virtual ~A_test(){};
std::string title;
std::string type;
virtual void func() = 0;
};
// mystruct ----------------------------------
struct mystruct {
public:
mystruct(int data = 0);
~mystruct();
int * get_data() const;
private:
int * _val;
};
std::ostream & operator<<(std::ostream & o, mystruct const * rhs);
// functions ---------------------------------
void add_to_list(std::string title, std::string type, A_test* test);
void delete_structs();
@@ -109,40 +80,6 @@ extern std::vector< mystruct* > mem_list;
add_to_list(#f_name, "int, mystruct*", new(s_ ## f_name <int, mystruct*>));\
*/
// templates print
// *****************************************
template <class T>
void print(ft::vector<T>& vec, std::string name) {
int i = 0;
typename ft::vector<T>::iterator it;
typename ft::vector<T>::iterator it_end = vec.end();
std::cout << "\n" << name << ":(vector)\n";
for (it = vec.begin(); it != it_end; ++it, i++)
std::cout << "[" << i << "]" << *it << " ";
std::cout << "\nsize:" << vec.size() << " capacty:" << vec.capacity() << "\n";
}
template <class T, class U>
void print(ft::map<T, U>& mp, std::string name) {
int i = 0;
typename ft::map<T, U>::iterator it;
typename ft::map<T, U>::iterator it_end = mp.end();
std::cout << "\n" << name << ":(map)\n";
for (it = mp.begin(); it != it_end; ++it, i++)
std::cout << "[" << i << "]" << it->first << ":" << it->second << " ";
std::cout << "\nsize:" << mp.size() << "\n";
}
template <class T, class cont>
void print(ft::stack<T,cont>& st, std::string name) {
std::cout << "\n" << name << ":(map)\n";
for (int i = st.size(); i > 0 ; i--, st.pop())
std::cout << "[" << i << "]" << st.top() << " ";
std::cout << "\nsize:" << st.size() << "\n";
}
// templates get value
// *************************************