#include <iostream>
template <class W, class T>
void foo(W& a, T& t)
{
std::cout << "generic" << std::endl;
}
template <template <bool> class W, class T>
void foo(W<true>& a, const T& t)
{
::foo(a, const_cast<T&>(t));
}
template <class W>
void foo(W& a, int& t)
{
std::cout << "int" << std::endl;
}
template <bool> struct what;
template<> struct what<true> { };
int main() {
const int ci = 10;
what<true> wt;
foo(wt, ci);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGUgPGNsYXNzIFcsIGNsYXNzIFQ+CnZvaWQgZm9vKFcmIGEsIFQmIHQpCnsKCXN0ZDo6Y291dCA8PCAiZ2VuZXJpYyIgPDwgc3RkOjplbmRsOwp9Cgp0ZW1wbGF0ZSA8dGVtcGxhdGUgPGJvb2w+IGNsYXNzIFcsIGNsYXNzIFQ+CnZvaWQgZm9vKFc8dHJ1ZT4mIGEsIGNvbnN0IFQmIHQpCnsKCTo6Zm9vKGEsIGNvbnN0X2Nhc3Q8VCY+KHQpKTsKfQoKdGVtcGxhdGUgPGNsYXNzIFc+CnZvaWQgZm9vKFcmIGEsIGludCYgdCkKewoJc3RkOjpjb3V0IDw8ICJpbnQiIDw8IHN0ZDo6ZW5kbDsKfQoKdGVtcGxhdGUgPGJvb2w+IHN0cnVjdCB3aGF0Owp0ZW1wbGF0ZTw+IHN0cnVjdCB3aGF0PHRydWU+IHsgfTsKCmludCBtYWluKCkgewoJY29uc3QgaW50IGNpID0gMTA7Cgl3aGF0PHRydWU+IHd0OwoKCWZvbyh3dCwgY2kpOwoKCXJldHVybiAwOwp9