Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::take_while_view<V,Pred>::pred

      From cppreference.com
      <cpp‎ |ranges‎ |take while view
       
       
      Ranges library
      Range adaptors
       
       
      constexprconst Pred& pred()const;
      (since C++20)

      Returns a reference to the stored predicatepred_.

      If*this does not store a predicate (e.g. an exception is thrown on the assignment to*this, which copy-constructs or move-constructs aPred), the behavior is undefined.

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      A reference to the stored predicate.

      [edit]Example

      Run this code
      #include <ranges> int main(){staticconstexprint a[]{1,2,3,4,5};constexprauto v= a| std::views::take_while([](int x){return x<4;});constauto pred= v.pred();    static_assert(pred(3));}

      [edit]See also

      returns a copy of the underlying (adapted) view
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/take_while_view/pred&oldid=173564"

      [8]ページ先頭

      ©2009-2025 Movatter.jp