#pragma once namespace TypeMagic { /** "Cleans" the given type T by stripping references (&) and cv-qualifiers (const, volatile) from it * const int => int * QString & => QString * const unsigned long long & => unsigned long long * * Usage: * using Cleaned = Detail::CleanType; * static_assert(std::is_same, "Cleaned == int"); */ // the order of remove_cv and remove_reference matters! template using CleanType = typename std::remove_cv::type>::type; /// For functors (structs with operator()), including lambdas, which in **most** cases are functors /// "Calls" Function or Function template struct Function : public Function {}; /// For function pointers (&function), including static members (&Class::member) template struct Function : public Function {}; /// Default specialization used by others. template struct Function { using ReturnType = Ret; using Argument = Arg; }; /// For member functions. Also used by the lambda overload if the lambda captures [this] template struct Function : public Function {}; template struct Function : public Function {}; /// Overload for references template struct Function : public Function {}; /// Overload for rvalues template struct Function : public Function {}; // for more info: https://functionalcpp.wordpress.com/2013/08/05/function-traits/ }