Namespaces
Variants

deref-move

From cppreference.com
 
 
Algorithm library
Constrained algorithms and algorithms on ranges (C++20)
Constrained algorithms, e.g. ranges::copy, ranges::sort, ...
Non-modifying sequence operations    
Batch operations
(C++17)
Search operations
Modifying sequence operations
Copy operations
(C++11)
(C++11)
Swap operations
Transformation operations
Generation operations
Removing operations
Order-changing operations
(until C++17)(C++11)
(C++20)(C++20)
Sampling operations
(C++17)

Sorting and related operations
Partitioning operations
(C++11)    

Sorting operations
Binary search operations
(on partitioned ranges)
Set operations (on sorted ranges)
Merge operations (on sorted ranges)
Heap operations
Minimum/maximum operations
(C++11)
(C++17)
Lexicographical comparison operations
Permutation operations


 
 
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

moves a range of objects to an uninitialized area of memory
(function template & algorithm function object)[edit]
moves a number of objects to an uninitialized area of memory
(function template & algorithm function object)[edit]