P-p-H-d / mlib

Library of generic and type safe containers in pure C language (C99 or C11) for a wide collection of container (comparable to the C++ STL).
BSD 2-Clause "Simplified" License
869 stars 76 forks source link

Missing explanation of how to access multiple values in a BPTREE_MULTI #121

Closed BrianSipos closed 4 months ago

BrianSipos commented 4 months ago

There is an explanation for how to declare a BPTREE_DEF* separately from a BPTREE_MULTI_DEF* and how it affects the storage logic and key uniqueness, but I don't see a way to actually access multiple values under the same key except for iterating over all of the items in the tree (which would defeat the purpose of using a tree for fast lookup).

Is there a separate API for looking up a BPTREE iterator from a key, or some other way of accessing the multiple possible values within a BPTREE_MULTI? There may already be so, I just cant find any documentation or explanation of it.

P-p-H-d commented 4 months ago

You can use the following API to iterate on the multiple values associated to a key:

(I have fixed the documentation of name_it_from which was incorrect). See example

BrianSipos commented 4 months ago

Thanks! I thought it was just the docs and not the interface.