Skip to content

Instantly share code, notes, and snippets.

View JPGygax68's full-sized avatar

Hans-Peter Gygax JPGygax68

View GitHub Profile
@JPGygax68
JPGygax68 / method_checking.cpp
Last active September 18, 2017 19:21
Check/assert whether a #class has a #method with a given #signature.
#include <iostream>
#include <string>
class A {
public:
void method1();
void method2(int);
static void method3(int []);
};
@JPGygax68
JPGygax68 / Aspect_composition.cpp
Last active May 17, 2016 21:23
Use C++11 template template parameters to add pseudo-aspects via chained inheritance
#include <iostream>
/*=======================================================================
* ASPECT COMPOSITION
*======================================================================*/
template<class Parent>
struct Nil_aspect: public Parent
{
void tell() {} // no-op, and ends the chain
#include <iostream>
/*=======================================================================
* ASPECT COMPOSITION
*======================================================================*/
/* This is the base class to be specialized via CRTP.
*
* It must provide all the methods that aspects can override as no-ops.
*/
@JPGygax68
JPGygax68 / zls_problem.zig
Created June 8, 2020 12:45
(Posted to help debugging a ZLS problem under VSCode)
const std = @import("std");
const c = @cImport({
// @cInclude("imgui/imgui.h");
// @cInclude("imgui/imgui_internal.h");
@cInclude("imgui/imstb_truetype.h");
@cInclude("imgui/imstb_rectpack.h");
});
const assert = std.debug.assert;
@JPGygax68
JPGygax68 / async_data.h
Last active November 3, 2020 10:19
A template class for obtaining data in the background, based on std::async() and std::future<>
#pragma once
#include <future>
/**
* Class template based on std::async and std::future<> to help in fetching data asynchronously.
*/
template <typename T>
struct async_data {