名稱空間
變體
操作

no-throw-input-iterator, no-throw-forward-iterator, no-throw-sentinel-for, no-throw-input-range, no-throw-forward-range

來自 cppreference.com
< cpp‎ | 記憶體
 
 
記憶體管理庫
(僅作說明*)
未初始化記憶體演算法
(C++17)
(C++17)
(C++17)
受約束的未初始化
記憶體演算法
C 庫

分配器
記憶體資源
垃圾回收支援
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
未初始化儲存
(直到 C++20*)
(直到 C++20*)
顯式生命週期管理
 
template< class I >

concept no-throw-input-iterator =
    std::input_iterator<I> &&
    std::is_lvalue_reference_v<std::iter_reference_t<I>> &&

    std::same_as<std::remove_cvref_t<std::iter_reference_t<I>>, std::iter_value_t<I>>;
(1) (僅作說明*)
template< class I >

concept no-throw-forward-iterator =
    no-throw-input-iterator<I> &&
    std::forward_iterator<I> &&

    no-throw-sentinel-for<I, I>;
(2) (僅作說明*)
template< class S, class I >
concept no-throw-sentinel-for = std::sentinel_for<S, I>;
(3) (僅作說明*)
template< class R >

concept no-throw-input-range =
    ranges::range<R> &&
    no-throw-input-iterator<ranges::iterator_t<R>> &&

    no-throw-sentinel-for<ranges::sentinel_t<R>, ranges::iterator_t<R>>;
(4) (僅作說明*)
template< class R >

concept no-throw-forward-range =
    no-throw-input-range<R> &&

    no-throw-forward-iterator<ranges::iterator_t<R>>;
(5) (僅作說明*)

這些僅用於解釋的概念指定了迭代器、哨兵和範圍上的演算法所需的操作不會丟擲異常。

1) no-throw-input-iterator 概念要求解引用迭代器產生一個左值,類似於 contiguous_iteratorLegacyForwardIterator

[編輯] 語義要求

與所有標準概念一樣,此處列出的每個概念僅在其所有子概念都被建模時才被建模。

1) 型別 I 僅當透過有效迭代器進行遞增、複製構造、移動構造、複製賦值、移動賦值或解引用操作不丟擲異常時,才建模 no-throw-input-iterator
3) 型別 SI 僅當透過型別 IS 的有效值之間的複製構造、移動構造、複製賦值、移動賦值或比較不丟擲異常時,才建模 no-throw-sentinel-for
4) 型別 R 僅當對型別 R 的物件呼叫 ranges::beginranges::end 不丟擲異常時,才建模 no-throw-input-range

[編輯] 注意

這些概念允許對迭代器和哨兵進行某些操作丟擲異常,例如對無效值的操作。

[編輯] 參閱

指定型別是一個輸入迭代器,即其引用的值可讀,並且可以進行前置和後置增量
(概念) [編輯]
指定input_iterator是前向迭代器,支援相等比較和多趟遍歷
(概念) [編輯]
指定型別是input_or_output_iterator型別的哨兵
(概念) [編輯]
指定其迭代器型別滿足 input_iterator 的範圍
(概念) [編輯]
指定其迭代器型別滿足 forward_iterator 的範圍
(概念) [編輯]