-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A type trait to indicate that a type is a proxy reference type #29
Comments
From the stream, a suggested unwrap_unreference can be further expanded to detect a wrapper by detecting either #include <utility>
namespace std0 {
namespace detail {
template <typename T>
using detect_unwrap_reference = decltype(unwrap_reference(std::declval<T>()));
}
struct unwrap_reference_niebloid {
template <typename T>
constexpr decltype(auto) operator()(T&& value) const noexcept {
// detect general unwrap ADL extension point
if constexpr (is_detected_v<detail::detect_unwrap_reference, T>) {
return unwrap_reference(std::forward<T>(value));
}
// Dr. WEB paper on is_specialization_of
else if constexpr (is_specialization_of_v<T, std::reference_wrapper>) {
return value.get();
}
else {
return std::forward<T>(value);
}
}
} inline constexpr unwrap_reference{};
template <typename T>
using unwrap_reference_t = decltype(std0::unwrap_reference(std::declval<T>()));
} |
Hey @ThePhD - i missed that comment, it seems worth exploring! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To fix tuple / get / pair for reference_wrapper and vectorreference
The text was updated successfully, but these errors were encountered: