Skip to content

Instantly share code, notes, and snippets.

@Jiwan
Jiwan / main.cpp
Last active November 3, 2018 05:49
C++11 example 2 SFINAE
#include <iostream>
struct A {};
std::string to_string(const A&)
{
return "I am a A!";
}
// Type B with a serialize method.
@Jiwan
Jiwan / main.cpp
Created October 30, 2015 16:13
C++11 example 1
#include <iostream>
struct A {};
std::string to_string(const A&)
{
return "I am a A!";
}
// Type B with a serialize method.
@Jiwan
Jiwan / main.cpp
Created October 29, 2015 12:09
C++98 SFINAE usage for serialization
#include <iostream>
struct A {};
std::string to_string(const A&)
{
return "I am a A!";
}
// Type B with a serialize method.
@Jiwan
Jiwan / gist:380618c1b21291097ef2
Created September 5, 2014 21:44
A c++11 way to apply a map function to some tuples
/***** maptuple.cpp *****/
#include <tuple>
#include <iostream>
#include <functional>
template<int ...S> struct indexes{};
template<int N, int ...S> struct generate_indexes : generate_indexes<N - 1, N - 1, S...> {};
@Jiwan
Jiwan / Guegant Jean
Created July 10, 2014 16:08
A c++11 way to apply a map function to some tuples
/***** maptuple.cpp *****/
#include <tuple>
#include <iostream>
#include <functional>
template<int ...S> struct indexes{};
template<int N, int ...S> struct generate_indexes : generate_indexes<N - 1, N - 1, S...> {};