Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1084,9 +1084,9 @@ Rust has solid interfaces for associative containers, largely due to the Entry I

- `CCC_Entry(container_pointer, key_pointer...)` - Obtains an entry, a view into an Occupied or Vacant user type stored in the container.
- `CCC_and_modify(entry_pointer, mod_fn)` - Modify an occupied entry with a callback.
- `CCC_and_modify_context(entry_pointer, mod_fn, context_args)` - Modify an Occupied entry with a callback that requires context data.
- `CCC_or_insert(entry_pointer, or_insert_args)` - Insert a default key value if Vacant or return the Occupied entry.
- `CCC_insert_entry(entry_pointer, insert_entry_args)` - Invariantly insert a new key value, overwriting an Occupied entry if needed.
- `CCC_and_modify_context(entry_pointer, mod_fn, context_arguments)` - Modify an Occupied entry with a callback that requires context data.
- `CCC_or_insert(entry_pointer, or_insert_arguments)` - Insert a default key value if Vacant or return the Occupied entry.
- `CCC_insert_entry(entry_pointer, insert_entry_arguments)` - Invariantly insert a new key value, overwriting an Occupied entry if needed.
- `CCC_remove_entry(entry_pointer)` - Remove an Occupied entry from the container or do nothing.

Other Rust Interface functions like `get_key_value`, `insert`, and `remove` are included and can provide information about previous values stored in the container.
Expand All @@ -1113,8 +1113,8 @@ This is possible because of the details discussed in the previous section. Conta

Some C++ associative container interfaces have also been adapted to the Entry Interface.

- `CCC_try_insert(container_pointer, try_insert_args)` - Inserts a new element if none was present and reports if a previous entry existed.
- `CCC_insert_or_assign(container_pointer, insert_or_assign_args)` - Inserts a new element invariantly and reports if a previous entry existed.
- `CCC_try_insert(container_pointer, try_insert_arguments)` - Inserts a new element if none was present and reports if a previous entry existed.
- `CCC_insert_or_assign(container_pointer, insert_or_assign_arguments)` - Inserts a new element invariantly and reports if a previous entry existed.

Many other containers fall back to C++ style interfaces when it makes sense to do so.

Expand Down Expand Up @@ -1175,7 +1175,7 @@ The same insertion with the "with" variant.
static inline struct Val
val(int val_arg)
{
return (struct Val){.val = val_args};
return (struct Val){.val = val_arguments};
}

CCC_Entry *e = adaptive_map_try_insert_with(&om, 3, val(1));
Expand Down
110 changes: 60 additions & 50 deletions ccc/adaptive_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -727,56 +727,66 @@ CCC_adaptive_map_validate(CCC_Adaptive_map const *map);
typedef CCC_Adaptive_map_node Adaptive_map_node;
typedef CCC_Adaptive_map Adaptive_map;
typedef CCC_Adaptive_map_entry Adaptive_map_entry;
# define adaptive_map_initialize(args...) CCC_adaptive_map_initialize(args)
# define adaptive_map_from(args...) CCC_adaptive_map_from(args)
# define adaptive_map_and_modify_with(args...) \
CCC_adaptive_map_and_modify_with(args)
# define adaptive_map_or_insert_with(args...) \
CCC_adaptive_map_or_insert_with(args)
# define adaptive_map_insert_entry_with(args...) \
CCC_adaptive_map_insert_entry_with(args)
# define adaptive_map_try_insert_with(args...) \
CCC_adaptive_map_try_insert_with(args)
# define adaptive_map_insert_or_assign_with(args...) \
CCC_adaptive_map_insert_or_assign_with(args)
# define adaptive_map_swap_entry_wrap(args...) \
CCC_adaptive_map_swap_entry_wrap(args)
# define adaptive_map_remove_key_value_wrap(args...) \
CCC_adaptive_map_remove_key_value_wrap(args)
# define adaptive_map_remove_entry_wrap(args...) \
CCC_adaptive_map_remove_entry_wrap(args)
# define adaptive_map_entry_wrap(args...) CCC_adaptive_map_entry_wrap(args)
# define adaptive_map_and_modify_wrap(args...) \
CCC_adaptive_map_and_modify_wrap(args)
# define adaptive_map_and_modify_context_wrap(args...) \
CCC_adaptive_map_and_modify_context_wrap(args)
# define adaptive_map_contains(args...) CCC_adaptive_map_contains(args)
# define adaptive_map_get_key_value(args...) \
CCC_adaptive_map_get_key_value(args)
# define adaptive_map_get_mut(args...) CCC_adaptive_map_get_mut(args)
# define adaptive_map_swap_entry(args...) CCC_adaptive_map_swap_entry(args)
# define adaptive_map_remove_key_value(args...) \
CCC_adaptive_map_remove_key_value(args)
# define adaptive_map_entry(args...) CCC_adaptive_map_entry(args)
# define adaptive_map_remove_entry(args...) \
CCC_adaptive_map_remove_entry(args)
# define adaptive_map_or_insert(args...) CCC_adaptive_map_or_insert(args)
# define adaptive_map_insert_entry(args...) \
CCC_adaptive_map_insert_entry(args)
# define adaptive_map_unwrap(args...) CCC_adaptive_map_unwrap(args)
# define adaptive_map_unwrap_mut(args...) CCC_adaptive_map_unwrap_mut(args)
# define adaptive_map_begin(args...) CCC_adaptive_map_begin(args)
# define adaptive_map_next(args...) CCC_adaptive_map_next(args)
# define adaptive_map_reverse_begin(args...) \
CCC_adaptive_map_reverse_begin(args)
# define adaptive_map_reverse_next(args...) \
CCC_adaptive_map_reverse_next(args)
# define adaptive_map_end(args...) CCC_adaptive_map_end(args)
# define adaptive_map_reverse_end(args...) CCC_adaptive_map_reverse_end(args)
# define adaptive_map_count(args...) CCC_adaptive_map_count(args)
# define adaptive_map_is_empty(args...) CCC_adaptive_map_is_empty(args)
# define adaptive_map_clear(args...) CCC_adaptive_map_clear(args)
# define adaptive_map_validate(args...) CCC_adaptive_map_validate(args)
# define adaptive_map_initialize(arguments...) \
CCC_adaptive_map_initialize(arguments)
# define adaptive_map_from(arguments...) CCC_adaptive_map_from(arguments)
# define adaptive_map_and_modify_with(arguments...) \
CCC_adaptive_map_and_modify_with(arguments)
# define adaptive_map_or_insert_with(arguments...) \
CCC_adaptive_map_or_insert_with(arguments)
# define adaptive_map_insert_entry_with(arguments...) \
CCC_adaptive_map_insert_entry_with(arguments)
# define adaptive_map_try_insert_with(arguments...) \
CCC_adaptive_map_try_insert_with(arguments)
# define adaptive_map_insert_or_assign_with(arguments...) \
CCC_adaptive_map_insert_or_assign_with(arguments)
# define adaptive_map_swap_entry_wrap(arguments...) \
CCC_adaptive_map_swap_entry_wrap(arguments)
# define adaptive_map_remove_key_value_wrap(arguments...) \
CCC_adaptive_map_remove_key_value_wrap(arguments)
# define adaptive_map_remove_entry_wrap(arguments...) \
CCC_adaptive_map_remove_entry_wrap(arguments)
# define adaptive_map_entry_wrap(arguments...) \
CCC_adaptive_map_entry_wrap(arguments)
# define adaptive_map_and_modify_wrap(arguments...) \
CCC_adaptive_map_and_modify_wrap(arguments)
# define adaptive_map_and_modify_context_wrap(arguments...) \
CCC_adaptive_map_and_modify_context_wrap(arguments)
# define adaptive_map_contains(arguments...) \
CCC_adaptive_map_contains(arguments)
# define adaptive_map_get_key_value(arguments...) \
CCC_adaptive_map_get_key_value(arguments)
# define adaptive_map_get_mut(arguments...) \
CCC_adaptive_map_get_mut(arguments)
# define adaptive_map_swap_entry(arguments...) \
CCC_adaptive_map_swap_entry(arguments)
# define adaptive_map_remove_key_value(arguments...) \
CCC_adaptive_map_remove_key_value(arguments)
# define adaptive_map_entry(arguments...) CCC_adaptive_map_entry(arguments)
# define adaptive_map_remove_entry(arguments...) \
CCC_adaptive_map_remove_entry(arguments)
# define adaptive_map_or_insert(arguments...) \
CCC_adaptive_map_or_insert(arguments)
# define adaptive_map_insert_entry(arguments...) \
CCC_adaptive_map_insert_entry(arguments)
# define adaptive_map_unwrap(arguments...) CCC_adaptive_map_unwrap(arguments)
# define adaptive_map_unwrap_mut(arguments...) \
CCC_adaptive_map_unwrap_mut(arguments)
# define adaptive_map_begin(arguments...) CCC_adaptive_map_begin(arguments)
# define adaptive_map_next(arguments...) CCC_adaptive_map_next(arguments)
# define adaptive_map_reverse_begin(arguments...) \
CCC_adaptive_map_reverse_begin(arguments)
# define adaptive_map_reverse_next(arguments...) \
CCC_adaptive_map_reverse_next(arguments)
# define adaptive_map_end(arguments...) CCC_adaptive_map_end(arguments)
# define adaptive_map_reverse_end(arguments...) \
CCC_adaptive_map_reverse_end(arguments)
# define adaptive_map_count(arguments...) CCC_adaptive_map_count(arguments)
# define adaptive_map_is_empty(arguments...) \
CCC_adaptive_map_is_empty(arguments)
# define adaptive_map_clear(arguments...) CCC_adaptive_map_clear(arguments)
# define adaptive_map_validate(arguments...) \
CCC_adaptive_map_validate(arguments)
#endif

#endif /* CCC_ADAPTIVE_MAP_H */
Loading