Skip to content

Instantly share code, notes, and snippets.

View indexed_list.cpp
#include <iostream>
#include <cstdint>
#include <vector>
#include <queue>
#include <list>
template <class SizeType, uint8_t MIN_LOG_INDEX, uint8_t BALANCE_LOG_RATIO, class Type>
struct TIndexedList
{
using Iterator = typename std::list<Type>::iterator;
View tghts.txt
What is math concretely?
From the outside, it resembles a group of people talking to each other. The theme of the discussion loosely depends on what was said before and no one really knows how it all started.
You can join in if you want but you will need to speak some dialect first. An implicit algorithm is used such that the people can agree on the validity of what is being said.
Some people have started to translate the discussion from the original set of evolving dialects into programming languages. In this new setting, the implicit algorithm can be made explicit and the translation checked mechanically. If no mistake is found in the algorithm or in the translation, we can be confident that what was said is indeed valid.
Given such an explicit algorithm and a complete enough record of the discussion, we could store a full verified translation. But this translation would be fairly redundant and we could try to compress it. Doing so, we would see that the bytes with the highest compression ratio would ma
View ast_1.out.json
{
"node": "Program",
"functions": [
{
"node": "Function",
"name": {
"node": "Identifier",
"lexeme": {
"node": "Lexeme",
"index": 42
View dummy_ast.cpp
#include <iostream>
#include <vector>
namespace node
{
enum class Kind
{
PROGRAM,
View equatable.cpp
#include <iostream>
namespace type_flag
{
template <class TypeFlag, class Type>
using THas = std::enable_if_t<std::is_base_of_v <TypeFlag, std::decay_t<Type>>, int>;
template <class TypeFlag, class Type>
using THasNot = std::enable_if_t<std::negation_v<std::is_base_of<TypeFlag, std::decay_t<Type>>>, int>;
View btf.cpp
#include <algorithm>
#include <iostream>
#include <cstdint>
#include <vector>
#include <array>
constexpr int log2(int x)
{
return x < 2 ? x : 1 + log2(x >> 1);
}
View tree.cpp
#include <iostream>
#include <cstdint>
#include <vector>
namespace tree
{
template <class Type>
struct TNode
{
View endianness.cpp
#include <iostream>
enum class Endianness
{
LITTLE,
BIG
};
Endianness makeEndianness()
{
View ColinDeWitBenchmarks.cpp
// http://coliru.stacked-crooked.com/a/661e096db956eca7
// Timing on my computer (with larger benchmarks)
// 0s 907ms 747us (benchmark_16_2048000_FULL_BUILD)
// 0s 919ms 263us (benchmark_16_2048000_SPTR_BUILD)
// 0s 620ms 877us (benchmark_16_2048000_FULL_PROBE)
// 0s 697ms 964us (benchmark_16_2048000_SPTR_PROBE)
//
// 0s 578ms 693us (benchmark_64_1024000_FULL_BUILD)
// 0s 527ms 744us (benchmark_64_1024000_SPTR_BUILD)
// 0s 440ms 486us (benchmark_64_1024000_FULL_PROBE)
View tail_list.cpp
#include <type_traits>
#include <memory>
#include <vector>
#include <iostream>
namespace buffer
{
template <class Type>