#include #include using namespace std; class flavor { public: void f() {cout << "non-const";} void f() const {cout << "const";} }; template void value(T t) {t.f(); cout << "\t"; T().f(); cout << "\n";} template void reference(T& t) {t.f(); cout << "\t"; T().f(); cout << "\n";} template void const_reference(const T& t) {t.f(); cout << "\t"; T().f(); cout << "\n";} int main() { const flavor s = flavor(); value(s); reference(s); const_reference(s); value(s); reference(s); const_reference(s); return EXIT_SUCCESS; }