MyGUI 3.2.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

Enumerator

Class for comfortable using of vectors with small while loop instead iterators. Performance is same as with iterators. Enumerator usage

typedef std::vector<std::string> VectorString;
typedef Enumerator<VectorString> EnumeratorVectorString;
VectorString vec;
vec.push_back("value");
//EnumeratorVectorString enum_vec(vec.begin(), vec.end());
EnumeratorVectorString enum_vec(vec);
while (enum_vec.next())
{
std::string value = enum_vec.current();
}
typedef std::pair<std::string, std::string> PairString;
typedef std::map<PairString> MapString;
MapString map;
map["key"] = "value";
//EnumeratorMapString enum_map(map.begin(), map.end());
EnumeratorMapString enum_map(map);
while (enum_map.next())
{
std::string key = enum_map.current().first;
std::string value = enum_map.current().second;
}