Last active
August 29, 2015 14:16
-
-
Save awgn/92bbd0310bf0afb9ab8c to your computer and use it in GitHub Desktop.
forward_as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T, typename V> | |
decltype(auto) | |
forward_as(V && value) | |
{ | |
return static_cast< | |
std::conditional_t< | |
std::is_lvalue_reference<T>::value, | |
std::remove_reference_t<V> &, | |
std::remove_reference_t<V> &&>>(value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment