Hi all,
I couldnt initialize the nested class members using constructor initialization list's. I am using Intel/Solaris/g++ compiler.
[code=cpp]
#include<iostre am>
template<class T>
class A{
private:
template<class U>
struct B{
U a;
B():a(23){std:: cout<<a; }
B(U e):a(e){std::co ut<<a;}
};
public:
//B<int> k -----------> works fine and prints out 23.
B<int> k(23); ----------->This doesn't work.
};
int main(){
A<int> a;
}
[/code]
Errors:
st.cpp:13: error: expected identifier before numeric constant
st.cpp:13: error: expected ',' or '...' before numeric constant.
Thanks in advance,
gs.
I couldnt initialize the nested class members using constructor initialization list's. I am using Intel/Solaris/g++ compiler.
[code=cpp]
#include<iostre am>
template<class T>
class A{
private:
template<class U>
struct B{
U a;
B():a(23){std:: cout<<a; }
B(U e):a(e){std::co ut<<a;}
};
public:
//B<int> k -----------> works fine and prints out 23.
B<int> k(23); ----------->This doesn't work.
};
int main(){
A<int> a;
}
[/code]
Errors:
st.cpp:13: error: expected identifier before numeric constant
st.cpp:13: error: expected ',' or '...' before numeric constant.
Thanks in advance,
gs.
Comment