LuaHashMap  1.0.0
Data Fields
LuaHashMapIterator Struct Reference

Defines the iterator type for LuaHashMap. More...

#include <LuaHashMap.h>

Data Fields

 
 
 
 
int  keyType
 
int  valueType
 
bool  atEnd
 
bool  isNext
 

Detailed Description

Defines the iterator type for LuaHashMap.

Iterators are the way to iterate through a hash table. Iterators in LuaHashMap conceptually similar to the C++ STL notion of an iterator (but much simpler).

Mental Model: LuaHashMapIterators (unlike LuaHashMap) are stack objects. No dynamic memory is required. This allows you to use iterators without worrying about freeing them when done and leaking. They are also generally seen as short term, inexpensive objects you should be able to refetch at will (an O(1) lookup by key). (But it is certainly possible to create iterators with dynamic memory and keep them around. Just watch out for them getting stale.)

Best practice is to use these structs as opaque objects. Use the API functions to retrieve values from the struct/iterators instead of direct access.

Trivia: You may notice that iterator functions that operate on the LuaHashMap instance don't require an explicit LuaHashMap instance passed into the function. This is because LuaHashMapIterator saves a copy of the LuaHashMap pointer when it was created.

Field Documentation

bool LuaHashMapIterator::atEnd
union LuaHashMapKeyValueType LuaHashMapIterator::currentKey
union LuaHashMapKeyValueType LuaHashMapIterator::currentValue
LuaHashMap* LuaHashMapIterator::hashMap
bool LuaHashMapIterator::isNext
int LuaHashMapIterator::keyType
int LuaHashMapIterator::valueType
LuaHashMap_InternalGlobalKeyType LuaHashMapIterator::whichTable

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

AltStyle によって変換されたページ (->オリジナル) /