Delen via


IIterator<T> Interface

Definition

Supports simple iteration over a collection.

public interface class IIterator
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.FoundationContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(1786374243, 17152, 17818, 153, 102, 203, 182, 96, 150, 62, 225)]
template <typename T>
struct IIterator
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)]
[Windows.Foundation.Metadata.Guid(1786374243, 17152, 17818, 153, 102, 203, 182, 96, 150, 62, 225)]
public interface IIterator<T>
Public Interface IIterator(Of T)

Type Parameters

T
Derived
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced in v1.0)

Remarks

The IIterator<T> interface isn't explicitly hidden by the language projection for .NET, but the IIterable\<T\> interface is hidden. For most .NET scenarios that specifically require an API for the iterator object, you'll probably use IEnumerator<T> (perhaps with a specific type constraint) as obtained from calling IEnumerable<T>.GetEnumerator.

If changes are made to the collection, such as adding, modifying, or deleting elements, the iterator is permitted to raise an exception for all operations.

C++/WinRT extension functions

Note

Extension functions exist on the C++/WinRT projection types for certain Windows Runtime APIs. For example, winrt::Windows::Foundation::IAsyncAction is the C++/WinRT projection type for IAsyncAction. The extension functions aren't part of the application binary interface (ABI) surface of the actual Windows Runtime types, so they're not listed as members of the Windows Runtime APIs. But you can call them from within any C++/WinRT project. See C++/WinRT functions that extend Windows Runtime APIs.

operator++();
operator++(int);

These operators permit ranged-for loops over Windows Runtime iterable objects. The prefix and postfix ++ operator advances the iterator, and sets it to nullptr if the iterator has completed.

T operator*() const;

Dereferencing the iterator is equivalent to calling Current.

using iterator_concept= std::input_iterator_tag;
using iterator_catetory = std::input_iterator_tag;
using value_type = T;
using difference_type = ptrdiff_t;
using pointer = void;
using reference = T;

Nested types that improve interoperability with C++ iterators.

Properties

Current

Gets the current item in the collection.

HasCurrent

Gets a value that indicates whether the iterator refers to a current item or is at the end of the collection.

Methods

GetMany(T[])

Retrieves multiple items from the iterator.

C++/WinRT The correct syntax for the C++/WinRT language projection is uint32_t GetMany(winrt::array_view<T> items);.

MoveNext()

Advances the iterator to the next item in the collection.

Applies to

See also