Skip to content

Instantly share code, notes, and snippets.

View mrkkrj's full-sized avatar
😀

Marek Krajewski mrkkrj

😀
View GitHub Profile
#include <utility>
// left fold by hand
template <typename F,typename Acc, typename... T>
constexpr auto foldLeft_initial(F func, Acc acc, T... xs)
{
auto step = [=](auto self, auto acc_, auto x_, auto... xs_)
{
auto sum = func(acc_, x_);
@mrkkrj
mrkkrj / cpp11-named-args.cpp
Last active August 29, 2015 13:57
minimal named arguments for C++ 11
#include <iostream>
template<typename Lhs, typename Rhs>
struct assignment_t
{
using lhs_t = Lhs;
using rhs_t = Rhs;
lhs_t _lhs;
rhs_t _rhs;
};