Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::common_view<V>::end

      From cppreference.com
      <cpp‎ |ranges‎ |common view
       
       
      Ranges library
      Range adaptors
       
       
      constexprauto end() requires(!/*simple-view*/<V>);
      (1)(since C++20)
      constexprauto end()const requiresranges::range<const V>;
      (2)(since C++20)
      1) Returns an iterator representing the end of thecommon_view, that is:
      2) Same as(1), butV is const-qualified.

      Contents

      [edit]Return value

      An iterator representing the end of the underlying view.

      [edit]Example

      Run this code
      #include <iostream>#include <numeric>#include <ranges> int main(){constexprint n{4}; constexprauto v1= std::views::iota(1)| std::views::take(n)| std::views::common;constexprauto v2= std::views::iota(2)| std::views::take(n);constint product=std::inner_product(v1.begin(), v1.end(),                                           v2.begin(),0);std::cout<< product<<'\n';}

      Output:

      40

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 4012C++20non-const overload missed simple-view checkadded

      [edit]See also

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

      [8]ページ先頭

      ©2009-2025 Movatter.jp