#include <iostream>
using namespace std;

template <class Hrm, class A>
void foo(Hrm& h, A& a)
{
	cout << "generic" << endl;
}

template <template <bool> class Hrg>
void foo(Hrg<false>& h, int& a)
{
	cout << "specialized int" << endl;
}

template <template <bool> class Hrg>
void foo(Hrg<true>& h, const int& a)
{
	cout << "specialized const-int" << endl;
}

template <bool W>
struct what;

template<> struct what<true> { };
template<> struct what<false> { };


int main() {
	what<true> wt;
	what<false> wf; 
	
	int i = 5;
	const int& ri = i;
	
	foo(wt, i);
	foo(wf, i);
	foo(wt, ri);
	foo(wf, ri);
	return 0;
}