aboutsummaryrefslogtreecommitdiff
path: root/src/vec/ft_veciter.c
blob: ec4a9174fed833886a7fcb33e5ef420274bf8d0b (plain)
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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_veciter.c                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/01 19:09:51 by charles           #+#    #+#             */
/*   Updated: 2020/04/01 20:15:13 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libft_vec.h"

/*
** \brief      Iterate a function over elements of a vector
** \param vec  Iterated vector
** \param f    Function applied to each elements
*/

void		ft_veciter(t_ftvec *vec, void (*f)(void *elem))
{
	size_t	i;

	i = 0;
	while (i < vec->size)
	{
		f(vec->data[i]);
		i++;
	}
}