#include <stdio.h>

template <class A, class B>             /* the general template */
class Cls {
    A first;
    B second;
public:
    const char *Which() const { return "general"; }
};

template <class X>                      /* the specializing variant */
class Cls<X, int> {
    X first;
    int count;
public:
    Cls() : count(0) {}
    const char *Which() const { return "second is int"; }
    void Count() { count++; }           /* exists only in this variant */
};

template <>                             /* a full specialization */
class Cls<double, int> {
public:
    const char *Which() const { return "exactly double, int"; }
};

int main()
{
    Cls<char, double> a;
    Cls<char, int> b;
    Cls<long, int> c;
    Cls<int, char> d;
    Cls<double, int> e;
    printf("Cls<char, double>:  %s\n", a.Which());
    printf("Cls<char, int>:     %s\n", b.Which());
    printf("Cls<long, int>:     %s\n", c.Which());
    printf("Cls<int, char>:     %s\n", d.Which());
    printf("Cls<double, int>:   %s\n", e.Which());
    b.Count();
#ifdef ERRORS
    a.Count();
#endif
    return 0;
}
