data_structures
max_pq_new.c
Go to the documentation of this file.
1 /* ************************************************************************** */
3 /* */
4 /* ::: :::::::: */
5 /* max_pq_new.c :+: :+: :+: */
6 /* +:+ +:+ +:+ */
7 /* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8 /* +#+#+#+#+#+ +#+ */
9 /* Created: 2020/07/17 01:46:17 by unite #+# #+# */
10 /* Updated: 2020/09/07 22:03:44 by unite ### ########.fr */
11 /* */
12 /* ************************************************************************** */
13 
14 #include "max_pq.h"
15 
16 t_max_pq *max_pq_new(const t_type *type)
17 {
18  if (!type->cmp)
19  ds_exit_set(EINVAL);
20  return (array_new(type));
21 }
max_pq.h
max_pq_new
t_max_pq * max_pq_new(const t_type *type)
Initializes a new empty priority queue.
Definition: max_pq_new.c:16
s_type::cmp
int(* cmp)(const void *, const void *)
(optional) A function ponter used to compare members of this data type
Definition: types.h:52
s_type
A full representation of a data type, used to achieve polymorphism in the implementation of data stru...
Definition: types.h:47
s_array
A resizable array.
Definition: array.h:47
array_new
t_array * array_new(const t_type *type)
Initializes a new empty array.
Definition: array_new.c:16
ds_exit_set
void ds_exit_set(int err)
Set errno to the specified value, print the error message, and exit the process.
Definition: ds_exit_set.c:22