GeezerVison is showing cpprefjp.github.io — std::ranges::is_heap - cpprefjp C++日本語リファレンス
最終更新日時:
2026年09月11日 13時06分31秒 (JST)
Akira Takahashi
が更新
履歴
編集
function template
<algorithm>
std::ranges:: is_heap (C++20)
namespace std :: ranges {
template < random_access_iterator I ,
sentinel_for < I > S ,
class Proj = identity ,
indirect_strict_weak_order < projected < I , Proj >> Comp = ranges::less >
constexpr bool
is_heap ( I first ,
S last ,
Comp comp = {},
Proj proj = {}); // (1) C++20
template < random_access_range R ,
class Proj = identity ,
indirect_strict_weak_order < projected < iterator_t < R > , Proj >> Comp = ranges::less >
constexpr bool
is_heap ( R && r ,
Comp comp = {},
Proj proj = {}); // (2) C++20
template < execution-policy Ep ,
random_access_iterator I ,
sized_sentinel_for < I > S ,
class Proj = identity ,
indirect_strict_weak_order < projected < I , Proj >> Comp = ranges::less >
bool
is_heap ( Ep && exec ,
I first ,
S last ,
Comp comp = {},
Proj proj = {}); // (3) C++26
template < execution-policy Ep ,
sized-random-access-range R ,
class Proj = identity ,
indirect_strict_weak_order < projected < iterator_t < R > , Proj >> Comp = ranges::less >
bool
is_heap ( Ep && exec ,
R && r ,
Comp comp = {},
Proj proj = {}); // (4) C++26
}
概要
範囲がヒープ化されているか判定する。
(1): イテレータ範囲を指定する
(2): Rangeを直接指定する
(3): (1)の並列アルゴリズム版。実行ポリシーを指定する
(4): (2)の並列アルゴリズム版。実行ポリシーを指定する
効果
ranges::is_heap_until (first, last, comp, proj) == last と等しい。
例
基本的な使い方
出力
before: is heap? false
after: is heap? true
並列アルゴリズムの例 (C++26)
出力
before: is heap? false
after: is heap? true
バージョン
言語
処理系
参照