Skip to content

Instantly share code, notes, and snippets.

View FredTingaud's full-sized avatar

Fred Tingaud FredTingaud

View GitHub Profile
@FredTingaud
FredTingaud / forwarding.cxx
Created April 14, 2017 14:42
Forwarding reference specialization
#include <iostream>
#include <type_traits>
using namespace std;
struct Car {};
void foo(const int&) { cout << "Ohh :(\n"; }
void foo(int&&) { cout << "Ahh :)\n"; }
void foo(const Car&) { cout << "Beep :(\n"; }
@FredTingaud
FredTingaud / pi_sampler.cpp
Last active March 11, 2017 12:47
FredTingaud's proposal for Pi Day Challenge
#include <range/v3/all.hpp>
#include <iostream>
#include <iterator>
#include <random>
#include <iomanip>
using namespace ranges::v3;
std::random_device random_device;
std::mt19937 engine{random_device()};