#include <type_traits> | |
template <typename T> | |
struct wrap; | |
template <typename T> | |
constexpr auto is_wrap_v = false; | |
template <typename T> | |
constexpr auto is_wrap_v<wrap<T>> = true; | |
template <typename T> | |
struct wrap { | |
auto operator->() { | |
if constexpr (is_wrap_v<T>) { | |
return value.operator->(); | |
} else { | |
return &value; | |
} | |
} | |
T value; | |
}; | |
struct vec2 { | |
float x, y; | |
}; | |
auto hello(wrap<wrap<wrap<vec2>>> w) { | |
return w->x + w->y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment