共用方式為


any_of

如果條件至少一次是在項目中,指定的範圍 true 傳回。

template<class InputIterator, class UnaryPredicate>
    bool any_of(
        InputIterator _First, 
        InputIterator _Last, 
        UnaryPredicate _Comp
    );

參數

  • _First
    在何處取得開始檢查項目範圍條件的輸入 Iterator。

  • _Last
    表示項目範圍的結尾檢查條件的輸入 Iterator。

  • _Comp
    測試的條件為。 使用者定義的述詞函式提供服務的物件。 述詞所定義的項目會滿足條件會測試。 述詞會採用單一引數並傳回 true 或 false。

傳回值

傳回 true ,如果條件中的指定範圍至少一次被偵測到, false ,如果從未偵測此情況。

備註

樣板函式傳回 true ,只有在,則範圍內的某個 N 的

[0, _Last - _First),這個述詞 _Comp(*(_First+ N)) 則為 true。

需求

標題: <algorithm>

命名空間: std

請參閱

參考

none_of

all_of

標準樣板程式庫