Skip to content

Instantly share code, notes, and snippets.

View BigETI's full-sized avatar
🤣
When GitHub stories?

Ethem Kurt BigETI

🤣
When GitHub stories?
View GitHub Profile
@Y-Less
Y-Less / curry.hpp
Created November 13, 2019 11:25
Curry functions. Can be improved with better move semantics.
#include <tuple>
#include <functional>
template <typename RET, typename FUNC, int N, typename... ARGS>
struct CurriedCaller
{
template <typename... TUPLED>
static RET Call(FUNC & f, std::tuple<TUPLED...> const & t, ARGS ...args)
{
return CurriedCaller<RET, FUNC, N - 1, decltype (std::get<N - 1>(t)), ARGS...>::Call(f, t, std::get<N - 1>(t), args...);