template<typename type_t>
class xtd::collections::generic::ienumerator< type_t >
Supports a simple iteration over a generic collection.
- Definition
template<typename type_t>
Supports a simple iteration over a generic collection.
Definition ienumerator.h:58
#define interface_
This keyword is use to represent an interface.
Definition interface.h:58
- Header
#include <xtd/collections/ienumerator
- Namespace
- xtd::collections::generic
- Library
- xtd.core
- Examples
- The following example shows an implementation of the xtd::collections::generic::ienumerator <type_t> interface for a collection class of custom objects. The custom object is an instance of the type Box, and the collection class is BoxCollection. This code example is part of a larger example provided for the ICollection<T> interface.
public:
explicit box_enumerator(const box_collection& boxes) : boxes {boxes} {}
const box& current()
const override {
return boxes[cur_index];}
bool move_next() override {return ++cur_index < boxes.count() ? true : false;}
private:
const box_collection& boxes;
size cur_index = box_integer<size>::max_value;
};
Represents a boxed integer object.
Definition box_integer.h:52
Represents a boxed object.
Definition box.h:53