std::ranges:: cend
|
定義先ヘッダ
<ranges>
|
||
|
定義先ヘッダ
<iterator>
|
||
|
inline
namespace
/* unspecified */
{
inline
constexpr
/* unspecified */
cend
=
/* unspecified */
;
|
(C++20以降)
(カスタマイゼーションポイントオブジェクト) |
|
|
呼び出しシグネチャ
|
||
|
template
<
class
T
>
requires
/* see below */
|
(C++20以降) | |
定数イテレータの終端を示すセンチネルを返します (定数イテレータ用) (C++23以降) 、 const修飾された (C++23以前) 範囲の終端を示します。
|
|
(C++23以前) |
|
引数が左辺値であるか、または
ranges::
enable_borrowed_range
<
std::
remove_cv_t
<
T
>>
が
true
の場合、
それ以外の場合、
|
(C++23以降) |
式
e
に対して
ranges
::
cend
(
e
)
が有効であり、
decltype
(
(
e
)
)
が
T
である場合、
CT
は
std::ranges::range
をモデルし、かつ
(C++23まで)
std::
sentinel_for
<
S, I
>
が常に
true
となる。ここで
S
は
decltype
(
ranges
::
cend
(
e
)
)
、
I
は
decltype
(
ranges::
cbegin
(
e
)
)
である。
さらに、
S
が
input_iterator
をモデルする場合は
constant-iterator
もモデルする。
(C++23以降)
カスタマイゼーションポイントオブジェクト
名前
ranges::cend
は
カスタマイゼーションポイントオブジェクト
を表し、これは
関数オブジェクト
のconst版で、
リテラル型
semiregular
クラス型である。詳細は
CustomizationPointObject
を参照。
例
#include <algorithm> #include <cassert> #include <ranges> #include <vector> int main() { std::vector vec{3, 1, 4}; int arr[]{5, 10, 15}; assert(std::ranges::find(vec, 5) == std::ranges::cend(vec)); assert(std::ranges::find(arr, 5) != std::ranges::cend(arr)); }
関連項目
|
(C++20)
|
範囲の終端を示すセンチネルを返す
(カスタマイゼーションポイントオブジェクト) |
|
(C++11)
(C++14)
|
コンテナまたは配列の終端を指すイテレータを返す
(関数テンプレート) |