P
Peter Liu
I have many structs, each of which has only one member, for example,
hehehh
I wrote a template for all of them, but I still want my function foo
--standalone-- to output the member of the struct used as a value of a
the declared map.
I guess this's also possible but don't know how .
Thanks
A simple example, T2 will be any struct.
struct A{int a};
struct B{int b};
template<class T1, class T2> void outpyt(std::map<T1, T2>&m)
{
typename std::map<T1, T2>::const_iterator it=m.begin();
for(;it!=m.end();++it)
//Output the second which is the member of the struct T2
}
hehehh
I wrote a template for all of them, but I still want my function foo
--standalone-- to output the member of the struct used as a value of a
the declared map.
I guess this's also possible but don't know how .
Thanks
A simple example, T2 will be any struct.
struct A{int a};
struct B{int b};
template<class T1, class T2> void outpyt(std::map<T1, T2>&m)
{
typename std::map<T1, T2>::const_iterator it=m.begin();
for(;it!=m.end();++it)
//Output the second which is the member of the struct T2
}