F
Fei Liu
Hello, I am having trouble to properly construct the 'show' function
definition. g++ 4.1.1 is giving me error messages but intel c++ compiler
compiles it fine. Which one is correct?
Fei
#include <iostream>
using namespace std;
template <typename T>
struct C{
struct S{
T x;
};
S s;
S show();
};
template <typename T>
C<T>::S C<T>::show(){
cout << s.x << '\n';
return s;
}
int main(){
C<int> c;
c.show();
}
~
~
~
definition. g++ 4.1.1 is giving me error messages but intel c++ compiler
compiles it fine. Which one is correct?
Fei
#include <iostream>
using namespace std;
template <typename T>
struct C{
struct S{
T x;
};
S s;
S show();
};
template <typename T>
C<T>::S C<T>::show(){
cout << s.x << '\n';
return s;
}
int main(){
C<int> c;
c.show();
}
~
~
~