Skip to content

Instantly share code, notes, and snippets.

View B1Z0N's full-sized avatar

Mykola Fedurko B1Z0N

View GitHub Profile
@B1Z0N
B1Z0N / container_printer.cpp
Last active July 19, 2019 11:41
customizable recursive container print
// code that looks common enough for me to write and post it here
// printing iterable of iterable/values of ... to ostream object
// works on any std conatiner and on any class that meets
// the requirements of Container(named requirement)
// ======================================================================
// compile with g++ container_printer.cpp -o container_printer -std=c++17
// other compilers not guaranteed to compile this
// ======================================================================
#include <functional>
#include <iostream>
using namespace std;
template <typename... RetTs, typename... ArgTs>
auto _for_each(std::function<RetTs(ArgTs...)>... funcs)
{
return [ = ] (ArgTs... args) {
return tuple {
@B1Z0N
B1Z0N / zipper.cpp
Created June 30, 2019 23:16
generic zip iterator for simple zipping in c++
#include <vector>
#include <tuple>
#include <iostream>
using namespace std;
template <
typename T1,
typename T2,