-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiter.hpp
More file actions
32 lines (27 loc) · 1.22 KB
/
iter.hpp
File metadata and controls
32 lines (27 loc) · 1.22 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* iter.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/01 21:30:11 by zelhajou #+# #+# */
/* Updated: 2025/01/03 17:07:24 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef ITER_HPP
#define ITER_HPP
#include <iostream>
template<typename T>
void iter(T* array, size_t length, void (*func)(T&))
{
for (size_t i = 0; i < length; i++)
func(array[i]);
}
template<typename T>
void iter(const T* array, size_t length, void (*func)(const T&))
{
for (size_t i = 0; i < length; i++)
func(array[i]);
}
#endif