Spec-Zone.ru › C++

deref-move

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

uninitialized_move
(C++17)
moves a range of objects to an uninitialized area of memory
(function template & algorithm function object)
ranges::uninitialized_move
(C++20)
uninitialized_move_n
(C++17)
moves a number of objects to an uninitialized area of memory
(function template & algorithm function object)
ranges::uninitialized_move_n
(C++20)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/memory/deref-move

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API