-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_test.cpp
More file actions
78 lines (64 loc) · 1.94 KB
/
my_test.cpp
File metadata and controls
78 lines (64 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* my_test.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mannouao <mannouao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/01 17:39:06 by mannouao #+# #+# */
/* Updated: 2022/07/31 12:45:56 by mannouao ### ########.fr */
/* */
/* ************************************************************************** */
# ifdef FT
#include "type_traits.hpp"
#include "algorithm.hpp"
#include "iterator.hpp"
#include "vector.hpp"
#include "stack.hpp"
#include "map.hpp"
#include "utility.hpp"
#include "set.hpp"
# elif STD
#include <type_traits>
#include <algorithm>
#include <iterator>
#include <vector>
#include <stack>
#include <utility>
#include <map>
#include <set>
#include <chrono>
#include <memory>
#include <limits.h>
namespace ft = std;
# endif
#include <iostream>
struct A
{
int* a;
A() { a = new int[100]; }
A(const A& other)
{
(void)other;
a = new int[100];
}
~A() { delete a; }
};
int main()
{
ft::map<int, A> map;
ft::vector<ft::pair<int, A> > v(100);
for (size_t i = 0; i < v.size(); ++i)
v[i].first = i;
v.push_back(ft::make_pair(1337, A()));
map[1337];
ft::map<int, A>::const_iterator iter = map.begin();
map.insert(v.begin(), v.end());
unsigned long long count = 0;
for (; iter != map.begin() ; --iter)
count += iter->first;
for (; iter != map.end(); ++iter)
count += iter->first;
std::cout << " => " << count << std::endl;
system("leaks run");
}