std::move_i...ove_iterator(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

okay bestie, welcome to std::move_iterator::move_iterator β€” page label std::move_i...ove_iterator(3) from the C++ Standard Libary manual (yes, that’s how it’s spelled in the header, I’m not fixing it πŸ˜­πŸ’…).

🌸 NAME 🌸

std::move_iterator::move_iterator β€” the constructor for a std::move_iterator, literally living the β€œsame name twice” icon life. It constructs a new iterator adaptor, bestie. ✨

✨ Synopsis ✨

The synopsis line wraps are giving chaotic manual formatting, but the tokens are sacred 🫢:

          move_iterator();                           (until C++17)
          constexpr move_iterator();                 (since C++17)
          explicit move_iterator(                                  (until
       C++17)
          iterator_type x );
          constexpr explicit move_iterator(                        (since
       C++17)
          iterator_type x );                 (1)
          template< class U >                    (2)
          move_iterator( const
       (until C++17)
          move_iterator<U>& other );                 (3)
          template< class U >
          constexpr move_iterator( const
       (since C++17)
          move_iterator<U>& other );

Constructs a new iterator adaptor. Slay. πŸŽ€

  1. Default constructor. The underlying iterator is value-initialized. Operations on the resulting iterator have defined behavior if and only if the corresponding operations on a value-initialized Iter also have defined behavior.
  2. The underlying iterator is initialized with x (until C++20) std::move(x) (since C++20).
  3. The underlying iterator is initialized with that of other. The behavior is undefined if U is not convertible to Iter (until C++20). This overload participates in overload resolution only if U is not the same type as Iter and std::convertible_to<const U&, Iter> is modeled (since C++20).

πŸ’… Parameters πŸ’…

  • x β€” iterator to adapt
  • other β€” iterator adaptor to copy

πŸŽ€ Example πŸŽ€

This section is incomplete. Reason: no example. 😭 The page is literally tagged * Todo no example, so no example bestie, that’s the whole tea. πŸ«–

πŸ’€ Defect reports πŸ’€

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

  • DR: LWG 3435; Applied to: C++20; Behavior as published: the converting constructor from another move_iterator was not constrained; Correct behavior: constrained.

πŸ¦‹ See also πŸ¦‹

  • operator= β€” assigns another iterator adaptor (C++11) (public member function)
  • make_move_iterator β€” creates a std::move_iterator of type inferred from the argument (C++11) (function template)

🌈 Category 🌈

  • * Todo no example β€” the category tag on the page, no cap.

okay bye bestie πŸ’– β€” source/version: http://cppreference.com; date: 2024.06.10; page tag: std::move_i...ove_iterator(3). πŸŽ€

πŸ“¦ where this page comes from