curry/uncurry implementation in C++11