Skip to content

Instantly share code, notes, and snippets.

@awgn
Last active August 29, 2015 14:16
Show Gist options
  • Save awgn/92bbd0310bf0afb9ab8c to your computer and use it in GitHub Desktop.
Save awgn/92bbd0310bf0afb9ab8c to your computer and use it in GitHub Desktop.
forward_as
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