Skip to content

Instantly share code, notes, and snippets.

@redpist
Created September 16, 2012 13:07
Show Gist options
  • Save redpist/3732389 to your computer and use it in GitHub Desktop.
Save redpist/3732389 to your computer and use it in GitHub Desktop.
Example C++ML 2
#ifndef _2_H_
#define _2_H_
#include <iostream>
struct Abidbul { };
template <int i>
struct NumType { };
template <template <class, class> class Temp>
struct OLol { };
template <typename T0, typename T1> // Americaine<int, double>
struct Americaine;
template <typename T0>
struct Americaine<T0, Abidbul> // Americaine<int, Abidbul>
{
void MondeDeMerde()
{
std::cout << "Americaine<int, Abidbul>" << std::endl;
}
};
template <int i>
struct Americaine<NumType<i>, Abidbul> // Americaine<NumType<42>, Abidbul>
{
void MondeDeMerde()
{
std::cout << "Americaine<NumType<42>, Abidbul>" << std::endl;
}
};
template <template <template <class, class> class> class Lol>
struct Americaine<Lol<Americaine>, Abidbul> // Americaine<OLol<Americaine>, Abidbul>
{
void MondeDeMerde()
{
std::cout << "Americaine<OLol<Americaine>, Abidbul>" << std::endl;
}
};
template <typename T0, typename T1> // Americaine<int, double>
struct Americaine
{
void MondeDeMerde()
{
std::cout << "Americaine<int, double>" << std::endl;
}
};
#endif /* _2_H_ */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment