| 12345678910111213141516171819202122232425262728 |
- //
- // lambda_cast.h
- // tax-calculator
- //
- // Created by Sam Jaffe on 10/8/20.
- //
- // Credit given to Nikos Athanasiou for this solution to the
- // problem of getting the argument types of a lambda.
- // https://stackoverflow.com/questions/13358672/
- //
- #pragma once
- #include <functional>
- namespace lambdas {
- template <typename T> struct memfun_type { using type = void; };
- template <typename Ret, typename Class, typename... Args>
- struct memfun_type<Ret (Class::*)(Args...) const> {
- using type = std::function<Ret(Args...)>;
- };
- template <typename F>
- typename memfun_type<decltype(&F::operator())>::type FFL(F const & func) {
- return func;
- }
- }
|