Skip to content

Instantly share code, notes, and snippets.

@tripulse
Last active November 6, 2020 07:03
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 tripulse/cb84bdb9930e26c18eef0fe25c9493ab to your computer and use it in GitHub Desktop.
Save tripulse/cb84bdb9930e26c18eef0fe25c9493ab to your computer and use it in GitHub Desktop.
#include <cinttypes>
#include <tuple>
template<class>
struct function_traits {};
template<class R, class... Args>
struct function_traits<R(Args...)> {
typedef R ret_t;
typedef std::tuple<Args...> args_t;
std::size_t n_args = std::tuple_size<args_t>::value;
typedef std::tuple<
std::remove_cv_t<
std::remove_reference_t<
std::remove_pointer_t<
std::remove_all_extents_t<Args>>>>...> args_pure_t;
template<std::size_t N>
struct arg { typedef std::tuple_element_t<N, args_t> type; };
template<std::size_t N>
using arg_t = typename arg<N>::type;
template<std::size_t N>
struct arg_pure { typedef std::tuple_element_t<N, args_pure_t> type; };
template<std::size_t N>
using arg_pure_t = typename arg_pure<N>::type;
};
@tripulse
Copy link
Author

tripulse commented Nov 6, 2020

I don't know what the fuck is this '-'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment