xtd 0.2.0
Loading...
Searching...
No Matches
enumerator.h
Go to the documentation of this file.
1
4#pragma once
5#include "ienumerator.h"
6#include "../../ptr.h"
7
9namespace xtd {
11 namespace collections {
13 namespace generic {
30 template<typename type_t>
31 class enumerator : public ienumerator<type_t> {
32 public:
34
37 enumerator() = default;
40 enumerator(ptr<ienumerator<type_t>> enumerator) : enumerator_ {enumerator} {} // Can't be explicit by design.
42
44 enumerator(enumerator&& enumerator) = default;
45 enumerator(const enumerator& enumerator) = default;
46 enumerator& operator =(const enumerator& enumerator) = default;
48
51
55 const type_t& current() const override {return enumerator_->current();}
57
59
64 bool move_next() override {return enumerator_->move_next();}
65
69 void reset() override {enumerator_->reset();}
71
72 private:
73 ptr<ienumerator<type_t>> enumerator_;
74 };
75 }
76 }
77}
Supports a simple iteration over a generic collection.
Definition enumerator.h:31
const type_t & current() const override
Gets the element in the collection at the current position of the enumerator.
Definition enumerator.h:55
enumerator(ptr< ienumerator< type_t > > enumerator)
Initializes a new instance of the xtd::collections::generic::enumerator <type_t> class with specified...
Definition enumerator.h:40
enumerator()=default
Initializes a new instance of the xtd::collections::generic::enumerator <type_t> class.
bool move_next() override
Advances the enumerator to the next element of the collection.
Definition enumerator.h:64
void reset() override
Sets the enumerator to its initial position, which is before the first element in the collection.
Definition enumerator.h:69
Supports a simple iteration over a generic collection.
Definition ienumerator.h:58
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.h:27
Contains xtd::collections::ienumerator alias.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10