IIterator<T> 介面

定義

支援集合上的簡單反復專案。

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)

類型參數

T
衍生
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.FoundationContract (已於 v1.0 引進)

備註

IIterator < T > 介面不會由 .NET 的語言投影明確隱藏,但IIterable\ < T\> 介面是隱藏的。 針對大部分需要 ITerator 物件的 API 的 .NET 案例,您可能會使用IEnumerator < T (可能具有特定類型條件約束) ,如同呼叫 IEnumerable T >取得。><GetEnumerator

如果對集合進行變更,例如新增、修改或刪除專案,則允許反覆運算器引發所有作業的例外狀況。

C++/WinRT 擴充功能函式

注意

延伸模組函式存在於特定Windows 執行階段 API 的 C++/WinRT 投影類型上。 例如,winrt::Windows::Foundation::IAsyncAction 是 IAsyncAction的 C++/WinRT 投影類型。 擴充函式不是應用程式二進位介面的一部分, (實際Windows 執行階段類型的 ABI) 介面,因此它們不會列為Windows 執行階段 API 的成員。 但您可以從任何 C++/WinRT 專案內呼叫它們。 請參閱擴充 Windows 執行階段 API 的 C++/WinRT 函式

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

這些運算子允許Windows 執行階段可逐一查看物件的範圍 for 迴圈。 前置詞和後置 ++ 運算子會前進反覆運算器,並在反覆運算器完成時將其設定為 nullptr

T operator*() const;

取消參考反覆運算器相當於呼叫 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;

可改善與 C++ 反覆運算器的互通性的巢狀類型。

屬性

Current

取得集合中的目前項目。

HasCurrent

取得值,這個值表示反覆運算器參考目前專案,還是位於集合結尾。

方法

GetMany(T[])

從反覆運算器擷取多個專案。

C++/WinRT C++/WinRT 語言投影的正確語法為 uint32_t GetMany(winrt::array_view<T> items);

MoveNext()

將反覆運算器前進至集合中的下一個專案。

適用於

另請參閱