Libft
Custom implementation of core libc functions with additional utility helpers.
Loading...
Searching...
No Matches
s_hashmap Struct Reference

Separate-chaining hash map keyed by NUL-terminated strings. More...

#include <libft.h>

Collaboration diagram for s_hashmap:

Data Fields

size_t size
 Current number of stored key/value pairs.
 
t_vector buckets
 Vector of t_list buckets (owned by the map).
 
size_t(* hash )(const char *key)
 Hash function applied to keys (defaults to hash_string).
 
void(* del_value )(void *)
 Optional destructor for stored values (may be NULL).
 

Detailed Description

Separate-chaining hash map keyed by NUL-terminated strings.

Collisions are resolved by chaining key/value pairs into doubly linked lists (one list per bucket). The bucket array is stored in a t_vector and grows automatically when the number of stored pairs would exceed its capacity.

Field Documentation

◆ buckets

t_vector s_hashmap::buckets

Vector of t_list buckets (owned by the map).

◆ del_value

void(* s_hashmap::del_value) (void *)

Optional destructor for stored values (may be NULL).

◆ hash

size_t(* s_hashmap::hash) (const char *key)

Hash function applied to keys (defaults to hash_string).

◆ size

size_t s_hashmap::size

Current number of stored key/value pairs.


The documentation for this struct was generated from the following file: