Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<int x> struct factorial {
- enum r {
- value = x * factorial<x - 1>::value
- };
- };
- template<> struct factorial<1> {
- enum r {
- value = 1
- };
- };
- class seventwenty: factorial<6> {
- };
- template<bool e, class t, class f> class ternary {
- typedef void tp;
- };
- template<class t, class f> class ternary<true, t, f> {
- typedef t tp;
- };
- template<class t, class f> class ternary<false, t, f> {
- typedef f tp;
- };
- template<typename o, typename p, typename q> struct matches {
- enum { value = 1 };
- };
- template<typename qq, typename pp> struct matches<pp, qq, qq> {
- enum { value = 2 };
- };
- template<typename pp, typename qq> struct matches<pp, pp, qq> {
- enum { value = 2 };
- };
- template<typename pp, typename qq> struct matches<pp, qq, pp> {
- enum { value = 2 };
- };
- template<typename pp> struct matches<pp, pp, pp> {
- enum { value = 3 };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement