Hi everyone. I've just started learning the STL stuff in C++ and was trying to make a very very simple template class. I tried to make a function below:
***********************************
template<typename THING>
void MyClass<THING>::Bringout
(
ostream& outstream
)
{
for (vector<THING>::size_type x=0; x<vec.size(); x++)
{
outputStream << vec.at(x);
}
}
//vec is a private vector
************************************
So for some reason, it does compile and it does run, but nothing shows up as output on the console screen. In the main function, I called this function as Bringout(cout)
Did I use the wrong syntax?
definitely not empty. I tried iterating it earlier using just integers in a different function using cout and it spat it all back out.
*new edit*
wanted to make sure all the syntax is correct here before I assume I made a mistake elsewhere when trying to handle different "types" in the same vector.
*second edit*
I'm stupid, it really is empty just before the for loop begins...