Skip to content

Instantly share code, notes, and snippets.

View perezite's full-sized avatar

Simon perezite

View GitHub Profile
@perezite
perezite / sfinae_tostring_ex.cpp
Created June 2, 2021 21:31 — forked from fenbf/sfinae_tostring_ex.cpp
C++ SFINAE example: how to detect if a class contains ToString method
// SFINAE, enable_if example
// based on http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence
#include <iostream>
#include <type_traits>
class ClassWithToString
{
public:
@perezite
perezite / playwav.c
Created July 6, 2019 14:17 — forked from armornick/playwav.c
Play a sound with SDL2 (no SDL_Mixer)
#include <SDL2/SDL.h>
#define MUS_PATH "Roland-GR-1-Trumpet-C5.wav"
// prototype for our audio callback
// see the implementation for more information
void my_audio_callback(void *userdata, Uint8 *stream, int len);
// variable declarations
static Uint8 *audio_pos; // global pointer to the audio buffer to be played