std::ranges::iter_move(3)
π NAME π
std::ranges::iter_moveβ okay so this is literallystd::ranges::iter_move, bestie. The manpage saysstd::ranges::iter_move - std::ranges::iter_move, and we are keeping all of that. This page is from the C++ Standard Libary manual (yes, that spelling is exactly what the manual says), and itβs all about thestd::ranges::iter_movecustomization point object.
πΈ Synopsis πΈ
Defined in header <iterator>
inline namespace /* unspecified */ {
inline constexpr /* unspecified */ iter_move = /* (since C++20)
unspecified */;
(customization point object)
}
Call signature
template< class T >
requires /* see below */ (since C++20)
constexpr decltype(auto) iter_move( T&& t )
noexcept(/* see below */);
What it does: it obtains an rvalue reference or a prvalue temporary from a given iterator. Thatβs the whole plot, but the mechanics are very specific.
ranges::iter_move(t) is expression-equivalent to:
iter_move(t), ifthas a class or enumeration type and the expression is well-formed when treated as an unevaluated operand, where the overload resolution ofiter_moveis performed only with the candidates found by argument-dependent lookup.- Otherwise,
std::move(*t)if*tis well-formed and is an lvalue. - Otherwise,
*tif*tis well-formed and is an rvalue.
In all other cases, a call to ranges::iter_move is ill-formed, which can result in substitution failure when ranges::iter_move(e) appears in the immediate context of a template instantiation.
π¨ Ifranges::iter_move(e)is not equal to*e, the program is ill-formed, no diagnostic required. That is the dramatic kind of caveat, bestie.
π Customization point objects π
The name ranges::iter_move denotes a customization point object, which is a const function object of a literal semiregular class type. For exposition purposes, the cv-unqualified version of its type is denoted as __iter_move_fn.
All instances of __iter_move_fn are equal. The effects of invoking different instances of type __iter_move_fn on the same arguments are equivalent, regardless of whether the expression denoting the instance is an lvalue or rvalue, and is const-qualified or not (however, a volatile-qualified instance is not required to be invocable). Thus, ranges::iter_move can be copied freely and its copies can be used interchangeably.
Given a set of types Args..., if std::declval<Args>()... meet the requirements for arguments to ranges::iter_move above, __iter_move_fn models
std::invocable<__iter_move_fn, Args...>,std::invocable<const __iter_move_fn, Args...>,std::invocable<__iter_move_fn&, Args...>, andstd::invocable<const __iter_move_fn&, Args...>.
Otherwise, no function call operator of __iter_move_fn participates in overload resolution.
π Example π
This section is incomplete. Reason: no example. Not me crying over a missing example, itβs giving tragic but iconic.
π See also π
iter_movecasts the result of dereferencing the adjusted underlying iterator to its associated rvalue reference type β (C++20) (function)iter_movecasts the result of dereferencing the underlying iterator to its associated rvalue reference type β (C++20) (function)
ποΈ Category ποΈ
Todo no example
Source/version/date check, bestie: http://cppreference.com Β· 2024.06.10 Β· std::ranges::iter_move(3) β okay bye, stay well-formed and hydrate π
β¨π«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms