This file contains hidden or 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
-- https://stackoverflow.com/questions/33988610/weird-behavior-of-syntax-sugarcolon-in-lua | |
local debug = require 'debug' | |
debug.setmetatable(0, { __index = math }) | |
debug.setmetatable(function() end, { __index = coroutine }) | |
debug.setmetatable(coroutine.create(function() end), { __index = coroutine }) | |
local table = require 'table' | |
table.new = function (self, t) | |
t = t or self |
This file contains hidden or 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
local maid64 = require 'maid64' | |
function resize(width, height) | |
local w, h = love.graphics.getDimensions() | |
width = math.max(maid64.sizeX, math.floor((width or w) / maid64.sizeX) * maid64.sizeX) | |
height = math.max(maid64.sizeY, math.floor((height or h) / maid64.sizeY) * maid64.sizeY) | |
maid64.resize(width, height) | |
if maid64.overscan then | |
maid64.x = (w - (maid64.scaler * maid64.sizeX)) / 2 | |
else |
This file contains hidden or 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 <iostream> | |
#include <variant> | |
#include <any> | |
#include <string> | |
#include <type_traits> | |
#include <functional> | |
#include <limits> | |
#include <unordered_map> | |
#include <stack> |
This file contains hidden or 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 <iostream> | |
#include <tuple> | |
#include <vector> | |
#include <unordered_map> | |
#include <string> | |
#include <cassert> | |
#include <functional> | |
#include <typeinfo> | |
#include <deque> |
This file contains hidden or 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 <iostream> | |
#include <type_traits> | |
template <auto *V> | |
struct floating_point_constant { | |
static constexpr auto value = *V; | |
static_assert(std::is_floating_point_v<decltype(value)>); | |
using value_type = decltype(value); |
This file contains hidden or 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 <iostream> | |
int foo() { return 123; } | |
int bar() { foo(); } | |
int main() | |
{ | |
std::cout << bar() << std::endl; | |
} |
This file contains hidden or 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 <iostream> | |
#include <memory> | |
class foo { | |
public: | |
foo() { std::cout << __func__ << std::endl; } | |
~foo() { std::cout << __func__ << std::endl; } | |
}; | |
class bar : public foo { |
This file contains hidden or 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 <iostream> | |
#include <functional> | |
#include <type_traits> | |
// impl ---------- | |
template <typename T, typename F = decltype(+std::declval<T>())> | |
class fn { | |
public: | |
using type = std::remove_pointer_t<F>; |
This file contains hidden or 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 <iostream> | |
// impl ---------- | |
template <auto V> | |
struct auto_constant { | |
static constexpr auto value = V; | |
using value_type = decltype(value); | |
using type = auto_constant; |
This file contains hidden or 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 <iostream> | |
#include <functional> | |
#include <memory> | |
// impl ---------- | |
struct state { | |
using pointer = std::shared_ptr<state>; | |
virtual pointer operator()() = 0; | |
}; |
NewerOlder