From c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sun, 11 Oct 2020 15:52:52 +0200 Subject: Removing libft/minishell_test submodules, Removing subject/README/etc --- libft/include/libft_vec.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 libft/include/libft_vec.h (limited to 'libft/include/libft_vec.h') diff --git a/libft/include/libft_vec.h b/libft/include/libft_vec.h new file mode 100644 index 0000000..287ce6f --- /dev/null +++ b/libft/include/libft_vec.h @@ -0,0 +1,60 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_vec.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/01 18:57:16 by charles #+# #+# */ +/* Updated: 2020/10/11 14:04:43 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LIBFT_VEC_H +# define LIBFT_VEC_H + +/* +** \file libft_vec.h +** \brief Vector manipulation +*/ + +# include +# include "libft_def.h" +# include "libft_mem.h" +# include "libft_algo.h" +# include "libft_lst.h" + +/* +** \brief Vector struct +** \param data Underlying array +** \param capacity Size of the underlying array +** \param size Number of element in the vector +*/ + +typedef struct s_ftvec +{ + void **data; + size_t capacity; + size_t size; +} t_ftvec; + +t_ftvec *ft_vecnew(size_t capacity); +void *ft_vecdestroy(t_ftvec *vec, void (*del)(void *elem)); +t_ftvec *ft_vecgrow(t_ftvec *vec); +t_ftvec *ft_vecreserve(t_ftvec *vec, size_t capacity); +t_ftvec *ft_vecpush(t_ftvec *vec, void *pushed); +t_ftvec *ft_vecpush_safe(t_ftvec *vec, void *pushed); +void ft_vecpop(t_ftvec *vec, void (*del)(void *elem)); +void ft_veciter(t_ftvec *vec, void (*f)(void *elem)); +void ft_veciter_addr(t_ftvec *vec, void (*f)(void **addr)); +void *ft_vectake(t_ftvec *vec, size_t i); +void ft_vecremove(t_ftvec *vec, size_t i, void (*del)(void *elem)); +t_ftvec *ft_vecinsert(t_ftvec *vec, size_t i, void *elem); +t_ftvec *ft_vecinsert_safe(t_ftvec *vec, size_t i, void *elem); +void ft_vecsort(t_ftvec *vec, t_ftcompar_func cmp); +void **ft_vecunwrap(t_ftvec *vec); +t_ftvec *ft_vecfrom_lst(t_ftlst *lst); +t_ftvec *ft_vecswallow_at( + t_ftvec *vec, size_t index, t_ftvec *swallowed); + +#endif -- cgit