◐ Shell
clean mode source ↗

deref-move - cppreference.com

From cppreference.com

template< class I >
constexpr decltype(auto) /*deref-move*/( I& iter )
(since C++17)
(exposition only*)

Returns the result of dereferencing iter as an rvalue:

  • If *iter is of an lvalue reference type, returns std::move(*iter).
  • Otherwise returns *iter directly.

Parameters

iter - the iterator for which the referred object will be moved

Return value

As described above.

Notes

This exposition-only function template is introduced by the resolution of LWG issue 3918. It is used to prevent the unnecessary move construction from the result of dereferencing iter if the result is already an rvalue.

See also