Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::drop_while_view<V,Pred>::begin

      From cppreference.com
      <cpp‎ |ranges‎ |drop while view
       
       
      Ranges library
      Range adaptors
       
       
      constexprauto begin();
      (since C++20)

      Returns an iterator to the first element of the view.

      Effectively returnsranges::find_if_not(base_,std::cref(pred())), wherebase_ is the underlying view. The behavior is undefined if*this does not store a predicate.

      In order to provide the amortized constant time complexity required by therange concept, this function caches the result within thedrop_while_view object for use on subsequent calls.

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      Iterator to the first element of the view.

      [edit]Example

      Run this code
      #include <cassert>#include <ranges> int main(){staticconstexprauto data={0,-1,-2,3,1,4,1,5};auto view= std::ranges::drop_while_view{data,[](int x){return x<=0;}};assert(view.begin()[0]==3);}

      [edit]See also

      returns an iterator or a sentinel to the end
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/drop_while_view/begin&oldid=173582"

      [8]ページ先頭

      ©2009-2025 Movatter.jp