Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

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

      From cppreference.com
      <cpp‎ |ranges‎ |take while view
       
       
      Ranges library
      Range adaptors
       
       
      constexpr V base()const& requiresstd::copy_constructible<V>;
      (1)(since C++20)
      constexpr V base()&&;
      (2)(since C++20)

      Returns a copy of the underlying view.

      1) Copy constructs the result from the underlying viewbase_.
      2) Move constructs the result from the underlying viewbase_.

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      A copy of the underlying view.

      [edit]Example

      Run this code
      #include <iostream>#include <ranges> namespace stq{void println(auto,constauto& v){for(constauto& e: v)std::cout<< e<<' ';std::cout<<'\n';}} int main(){staticconstexprint a[]{1,2,3,4,5};constexprauto view= a| std::views::take_while([](int x){return x<4;});    stq::println("{}", view);constauto base= view.base();    stq::println("{}", base);}

      Output:

      1 2 31 2 3 4 5

      [edit]See also

      returns a reference to the stored predicate
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/take_while_view/base&oldid=173565"

      [8]ページ先頭

      ©2009-2025 Movatter.jp