-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (33 loc) · 1.48 KB
/
Copy pathmain.cpp
File metadata and controls
42 lines (33 loc) · 1.48 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dpoveda- <me@izenynn.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/19 13:13:23 by dpoveda- #+# #+# */
/* Updated: 2022/02/19 13:22:45 by dpoveda- ### ########.fr */
/* */
/* ************************************************************************** */
#include "iter.hpp"
#include <iostream>
template<typename T>
void debug(const T& var) {
std::cout << var << std::endl;
}
template<typename T>
void increment(const T& var) {
++(const_cast<T&>(var));
}
int main() {
int arrInt[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
std::string arrString[4] = {"abc", "dfg", "hij", "klm"};
std::cout << "INT ARRAY:\n" << std::endl;
::iter(arrInt, 10, &debug);
std::cout << "\nINT ARRAY (after increment):\n" << std::endl;
::iter(arrInt, 10, &increment);
::iter(arrInt, 10, &debug);
std::cout << "\nSTRING ARRAY:\n" << std::endl;
::iter(arrString, 4, &debug);
return 0;
}