Below code block won't compile when invoking template member function (on template parameter) without taking advantage template argument deduction. Can someone point out what I'm missing here, TIA.
struct Foo
{
template<typename T>
void set(const T& thing) { }
};
template<typename T>
class Bar
{
public:
Bar() {
// struct Foo declared
f.set(5); // compiles
f.set<int>(5); // compiles
// struct Foo via template parameter type T
t.set(5); // compiles
t.set<int>(5); // doesn't compile
}
Foo f;
T t;
};
int
main(int argc, char* argv[])
{
Bar<Foo> b;
}
Code also available at http://coliru.stacked-crooked.com/a/50294c63b3acdef9