Unnamed
public text v1 · immutable#include <iostream>
using namespace std;
template<int N, int M>
class blah
{
public:
void foo();
};
template <>
void blah<0,0>::foo()
{
cout<<"Both elements are zero"<<endl;
}
template <int M>
void blah<M, 1>::foo()
{
cout<<"The right element is 1"<<endl;
}
template <int N, int M>
void blah<N,M>::foo()
{
cout<<"It is something else"<<endl;
}
int main(int argn, char** args)
{
blah<0,0> zero;
zero.foo();
blah<1,0> one;
one.foo();
blah<2,2> two;
two.foo();
}