Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::split_view<V,Pattern>::base

      From cppreference.com
      <cpp‎ |ranges‎ |split 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 viewbase_.

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

      Contents

      [edit]Return value

      1) A copy of the underlying view.
      2) A view move-constructed from the underlying view.

      [edit]Example

      Run this code
      #include <iomanip>#include <iostream>#include <ranges>#include <string_view> int main(){constexprstd::string_view keywords{"this throw true try typedef typeid"};    std::ranges::split_view split_view{keywords,' '};std::cout<<"base() = "<<std::quoted(split_view.base())<<"\n""substrings: ";for(auto split: split_view)std::cout<<std::quoted(std::string_view{split})<<' ';std::cout<<'\n';}

      Output:

      base() = "this throw true try typedef typeid"substrings: "this" "throw" "true" "try" "typedef" "typeid"

      [edit]Defect reports

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

      DRApplied toBehavior as publishedCorrect behavior
      LWG 3590C++20theconst& overload additionally required validity of copy-assignmentconstraints relaxed

      [edit]See also

      returns a copy of the underlying (adapted) view
      (public member function ofstd::ranges::lazy_split_view<V,Pattern>)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/split_view/base&oldid=179909"

      [8]ページ先頭

      ©2009-2025 Movatter.jp