Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::move_iterator<Iter>::base

      From cppreference.com
      <cpp‎ |iterator‎ |move iterator
       
       
      Iterator library
      Iterator concepts
      Iterator primitives
      Algorithm concepts and utilities
      Indirect callable concepts
      Common algorithm requirements
      (C++20)
      (C++20)
      (C++20)
      Utilities
      (C++20)
      Iterator adaptors
      Range access
      (C++11)(C++14)
      (C++14)(C++14)  
      (C++11)(C++14)
      (C++14)(C++14)  
      (C++17)(C++20)
      (C++17)
      (C++17)
       
       
      (1)
      iterator_type base()const;
      (constexpr since C++17)
      (until C++20)
      constexprconst iterator_type& base()const&noexcept;
      (since C++20)
      constexpr iterator_type base()&&;
      (2)(since C++20)

      Returns the underlying iterator.

      1) Returns acopy of(until C++20)reference to(since C++20) the underlying iterator.
      2) Returns an iterator move constructed from the underlying iterator.

      Contents

      [edit]Return value

      1)current
      2)std::move(current )

      [edit]Example

      Run this code
      #include <algorithm>#include <iostream>#include <iterator>#include <vector> int main(){std::vector<int> v{0,1,2,3,4};std::move_iterator<std::vector<int>::reverse_iterator>        m1{v.rbegin()},        m2{v.rend()}; std::copy(m1.base(), m2.base(),std::ostream_iterator<int>(std::cout," "));std::cout<<'\n';}

      Output:

      4 3 2 1 0

      [edit]Defect reports

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

      DRApplied toBehavior as publishedCorrect behavior
      LWG 3391C++20overload(1) returned a copy of the underlying iteratorreturns a reference
      LWG 3593C++20overload(1) was not noexceptmade noexcept

      [edit]See also

      accesses the pointed-to element
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/iterator/move_iterator/base&oldid=177405"

      [8]ページ先頭

      ©2009-2025 Movatter.jp