Skip to content

Instantly share code, notes, and snippets.

@condy0919
Created July 20, 2016 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save condy0919/5dc8cb0387c5246fd68e93048caedd24 to your computer and use it in GitHub Desktop.
Save condy0919/5dc8cb0387c5246fd68e93048caedd24 to your computer and use it in GitHub Desktop.
#include <utility>
using namespace std;
auto l = [](char, int) { return 1.0; };
struct foo {
int operator()(int, char) { return 0; }
};
template <typename C, typename T>
auto prototype_of_impl(T C::* const) -> std::decay_t<T>;
//template <typename C, typename T>
//auto prototype_of_impl(T C::*) -> std::decay_t<T>;
template <typename T>
struct prototype_of {
using type = decltype(prototype_of_impl(&T::operator()));
};
int main() {
//using T = prototype_of<decltype(l)>::type;
using F = prototype_of<foo>::type;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment