citerators · Section 3
ccol_iter_key_ptr
NAME
ccol_iter_key_ptr - get a typed const pointer to the current key
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/citerators.h> /* or any container header */ const KeyT *ccol_iter_key_ptr(it);
DESCRIPTION
ccol_iter_key_ptr returns a typed const pointer to the key of the element that the iterator is on. For a cvec iterator the key is the element's index, a size_t. For a chmap or a cbmap iterator it is the real map key. A char-pointer key comes back as a (char *const *) into the map's internal storage, and the string it points to belongs to the map. Every other key type comes back as a direct typed pointer.
PARAMETERS
it Iterator variable that ccol_iter_declare() declares, or an iterator
inside ccol_for_each().
RETURN VALUE
A const KeyT* to the current key. Do not free or change the value through this pointer.
NOTES
The pointer is valid only while the iterator is alive and the container does not change. The macro uses a GNU C statement expression, so it needs GCC or Clang.