C Container Collection (CCC)
|
A key comparison helper to avoid argument swapping. More...
#include <types.h>
A key comparison helper to avoid argument swapping.
The key is considered the left hand side of the operation if three-way comparison is needed. Left and right do not matter if equality is needed. Note a comparison is taking place between the key on the left hand side and the complete user type on the right hand side. This means the right hand side will need to manually access its key field.
Notice that the user type must access its key field of its struct. Comparison must happen this way to support searching by key in associative containers rather than by entire user struct. Only needing to provide a key can save significant memory for a search depending on the size of the user type.
Data Fields | |
void const *const | any_key_lhs |
void const *const | any_type_rhs |
void * | aux |
void const* const ccc_any_key_cmp::any_key_lhs |
Key matching the key field of the provided type to the container.
void const* const ccc_any_key_cmp::any_type_rhs |
The complete user type stored in the container.
void* ccc_any_key_cmp::aux |
A reference to aux data provided to the container on initialization.