Skip to content

Instantly share code, notes, and snippets.

View kim366's full-sized avatar

Kim Schmider kim366

  • Sydney
View GitHub Profile
template<typename Op, typename Tuple, std::size_t... Is>
void invoke(Op op, const Tuple& args, std::index_sequence<Is...>)
{
op(std::get<Is>(args)...);
}
template<typename Op, typename... Args>
void invoke(Op op, const std::tuple<Args...>& args)
{
invoke(op, args, std::index_sequence_for<Args...>{});
template<int N, typename Tupl, typename Op>
struct tuple_transform_impl
{
static void increment(Tupl& tuple, Op op)
{
std::get<N>(tuple) = op(std::get<N>(tuple));
tuple_transform_impl<N - 1, Tupl, Op>::increment(tuple, op);
}
};
#include <any>
#include <cassert>
#include <utility>
#include <vector>
enum class param_type
{
templated,
normal
};
#include <cassert>
template<typename T>
struct types_match
{
static bool match() { return false; }
};
#define SYNC(cpp_type, type_name) \
template<> \
#include <utility>
template<typename T>
struct sample_templated
{
T x;
int y;
};
using instanciated = sample_templated<double>;
template<unsigned, typename...>
struct ntuple_impl;
template<unsigned N, typename E, typename... Es>
struct ntuple_impl<N, std::enable_if_t<(N > 1)>, E, Es...>
{
using type = typename ntuple_impl<N - 1, void, E, E, Es...>::type;
};
template<typename... Es>
#include <iostream>
#include <tuple>
template<unsigned, typename...>
struct ntuple_impl;
template<unsigned N, typename E, typename... Es>
struct ntuple_impl<N, std::enable_if_t<(N > 1)>, E, Es...>
{
using type = typename ntuple_impl<N - 1, void, E, E, Es...>::type;
#pragma once
#include <Identifiers.hpp>
#include <Inputs.hpp>
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Transformable.hpp>
#include <SFML/Graphics/View.hpp>
#include <SFML/System/Vector2.hpp>
#include <Utility.hpp>
@kim366
kim366 / debugger.jl
Last active November 17, 2018 08:27
const breakpoints = Int[4, 6]
const registeredvars = Symbol[]
const filename = "testscript.jl"
module Exec end
function evalandregister(line::String)
ast = Meta.parse(line)
typeof(ast) == Expr || return
if length(ast.args) == 2 && typeof(ast.args[1]) == Symbol
@kim366
kim366 / julia-speed-increase.cpp
Created October 31, 2018 17:03
Julia Benchmark comparing the performance of `jl_eval_string` over `jl_get_global` and evaluating every frame. 648x (!) speed increase
#include "/usr/include/julia/julia.h"
#include <chrono>
#include <cstdio>
int main() {
jl_init();
std::chrono::high_resolution_clock c;
jl_eval_string("module Some module Nested module Module function f(a::Int64) "
"end end end end");
auto t1 = c.now();