Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::adjacent_view<V,N>::begin

      From cppreference.com
      <cpp‎ |ranges‎ |adjacent view
       
       
      Ranges library
      Range adaptors
       
      std::ranges::adjacent_view
      Member functions
      adjacent_view::begin
      Iterator
      Member functions
      Non-member functions
      Sentinel
      Member functions
      Non-member functions
       
      constexprauto begin() requires(!__SimpleView<V>);
      (1)(since C++23)
      constexprauto begin()const requiresranges::range<const V>;
      (2)(since C++23)

      Returns aniterator to the first element of theadjacent_view.

      Letbase_ be the underlying view.

      1) Equivalent toreturn/*iterator*/<false>(ranges::begin(base_),ranges::end(base_));.
      2) Equivalent toreturn/*iterator*/<true>(ranges::begin(base_),ranges::end(base_));.

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      Iterator to the first element.

      [edit]Example

      Run this code
      #include <ranges>#include <tuple>#include <type_traits> int main(){constexprstaticauto v={'A','B','C','D','E'}; constexprauto view= std::views::adjacent<3>(v); constexprauto tuple=*view.begin();     static_assert(std::is_same_v<            decltype(tuple),conststd::tuple<charconst&,charconst&,charconst&>>);     static_assert(        std::get<0>(tuple)=='A'&&        std::get<1>(tuple)=='B'&&        std::get<2>(tuple)=='C');}

      [edit]See also

      returns an iterator or a sentinel to the end
      (public member function)[edit]
      returns an iterator to the beginning of a range
      (customization point object)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/adjacent_view/begin&oldid=156858"

      [8]ページ先頭

      ©2009-2025 Movatter.jp