Skip to content

Instantly share code, notes, and snippets.

View indiosmo's full-sized avatar

Luiz Siqueira indiosmo

  • São Paulo, SP - Brazil
View GitHub Profile
@indiosmo
indiosmo / gist:3f625d400f4243bfc28fbdc7d8039682
Last active May 8, 2020 17:49
C++20 parameter pack perfect capture
#include <iostream>
#include <string>
template <class T, class...Args>
auto ftemplate(T& t) {
auto thunk = [&t](auto& f, Args&&... args) {
auto post = [&t, &f, ... args = std::forward<Args>(args)] {
f(t, std::forward<decltype(args)>(args)...);
};
@indiosmo
indiosmo / fsm.hpp
Created August 14, 2018 01:58
SML - Hierarchical Machine
struct client_protocol
{
// clang-format off
// public interface
struct ev_connect{};
struct ev_disconnect{};
// connection handlers
struct ev_error{};