is_sorted
如果指定範圍內的元素進行排序順序,傳回 true 。
template<class ForwardIterator>
bool is_sorted(
ForwardIterator _First,
ForwardIterator _Last
);
template<class ForwardIterator, class BinaryPredicate>
bool is_sorted(
ForwardIterator _First,
ForwardIterator _Last,
BinaryPredicate _Comp
);
參數
_First
表示的正向 iterator 檢查這個範圍的開始處。_Last
表示範圍結尾的正向 iterator。_Comp
要測試的條件決定在兩個項目之間的一個命令。 述詞使用單一引數並傳回 true 或 false。 這個執行工作與 operator<相同。
屬性值/傳回值
傳回 true ,如果指定範圍中的項目排序順序,則為 false ,如果不是。
備註
第一個樣板函式會傳回 is_sorted_until(_First,_Last) ==_Last。 運算子< 函式執行順序比較。
第二個樣板函式會傳回 is_sorted_until(_First,_Last,_Comp) ==_Last。 _Comp 述詞函式執行順序比較。
需求
標頭:<algorithm>
命名空間: std