最終更新日時(UTC): 2024年06月11日 13時45分38秒 Akira Takahashi が更新
履歴 編集
constexpr reference front() const;
参照範囲の先頭要素を取得する。
empty()
false
以下と等価:
return *data();
定数時間
#include <cassert> #include <span> #include <vector> int main() { std::vector<int> v = {1, 2, 3, 4, 5}; int& x = std::span{v}.front(); assert(x == 1); int& y = std::span{v}.subspan(2, 3).front(); assert(y == 3); }