This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <tuple> | |
#include <iostream> | |
using namespace std; | |
template < | |
typename T1, | |
typename T2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
// ====================================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// finding maximal and minimalelement in variadic number of arguments | |
#include <iostream> | |
namespace cmns { | |
// commons | |
// *************MAXIMAL*VALUE*FUNCTIONS**************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
//*********************TRANSFORMATION*TRAITS*************************** | |
// Remove reference | |
template <typename T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code for generation of predicate traits | |
// compile with g++ -std=c++17 ... | |
#include <utility> | |
#include <vector> | |
#include <iostream> | |
// ***************IMPLEMENTATION*************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2019-12-03T21:06:53.375Z","extensionVersion":"v3.4.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const curry = (f) => { | |
const argc = f.length; | |
if (argc === 1) { | |
return f; | |
} | |
return (a) => curry(f.bind(null, a), argc - 1); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Number of leading zeroes: builtin_clz(x) | |
// Number of trailing zeroes : builtin_ctz(x) | |
// Number of 1-bits: __builtin_popcount(x) | |
// The parity (even or odd) of the number of ones: __builtin_parity(x) | |
// a * 2^n | |
constexpr int multiplyByPowerOf2(int a, int n) { | |
return a << n; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
___,,___ | |
,d8888888888b,_ | |
_,d889' 8888b, | |
_,d8888' 8888888b, | |
_,d8889' 888888888888b,_ | |
_,d8889' 888888889'688888, /b | |
_,d8889' 88888889' `6888d 6,_ | |
,d88886' _d888889' ,8d b888b, d\ | |
,d889'888, d8889' 8d 9888888Y ) |
OlderNewer