![]() |
libfilezilla
|
A function that acts like std::forward, but applies the value category of its first template parameter. More...
#include <type_traits>
Go to the source code of this file.
Namespaces | |
fz | |
The namespace used by libfilezilla. | |
Typedefs | |
template<class T , class U > | |
using | apply_value_category_t = std::conditional_t< std::is_lvalue_reference_v< T >, std::remove_reference_t< U > &, std::remove_reference_t< U > && > |
Functions | |
template<class T , class U > | |
constexpr detail::apply_value_category_t< T, U > | forward_like (U &&u) noexcept |
applies the value category of T to u, so that u can be perfectly forwarded as-if it were of type T. | |
A function that acts like std::forward, but applies the value category of its first template parameter.
It can be used, for instance, to perfect forward the member of a struct according to the value category of the object that is the instance of that struct.
Inspired by Vittorio Romeo's proposal: https://vittorioromeo.info/Misc/fwdlike.html