Files
cpp07/ex01/iter.hpp
2026-03-23 14:45:44 +01:00

38 lines
1.3 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* iter.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/23 14:19:16 by aortigos #+# #+# */
/* Updated: 2026/03/23 14:25:35 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef ITER_HPP
# define ITER_HPP
# include <iostream>
template <typename PTR, typename T>
void iter(PTR *address, unsigned int const length, T func)
{
for (unsigned int i = 0; i < length; i++)
{
func(address[i]);
}
}
template <typename PTR, typename T>
void iter(PTR const *address, unsigned int const length, T func)
{
for (unsigned int i = 0; i < length; i++)
{
func(address[i]);
}
}
#endif