template <typename T>
struct S
{
void F() { T::F(); }
};
int _tmain(int argc, _TCHAR* argv[])
{
S<int> s;
// ...
s.F();
return 0;
}
If I change sligthly your code so that "T" is a class :
int main()
{
S<std::string> s;
s.F();
return 0;
}
then I get another error message:
1>d:\users\adb\dev\temp\test_vc_2005\test_vc_2005.cpp(11) : error
C2039: 'F' : is not a member of 'std::basic_string<_Elem,_Traits,_Ax>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> d:\users\adb\dev\temp\test_vc_2005\test_vc_2005.cpp(11) :
while compiling class template member function 'void S<T>::F(void)'
1> with
1> [
1> T=std::string
1> ]
1> d:\users\adb\dev\temp\test_vc_2005\test_vc_2005.cpp(17) : see
reference to class template instantiation 'S<T>' being compiled
1> with
1> [
1> T=std::string
1> ]
Although those errors are quite (too) long, thay are quite clear (at
least for template related stuff....)
I don't think so. There's still no reference at all to the s.F(); line,
it only points out the S<std::string> s; line. If those two weren't
is referenced.