Say I have a vector of chars and I pushed it into a stream as a string, rather than a vector of chars, how would i get back the vector of chars using operator>>?
class C{
private:
vector<char> c;
public:
C(string str){
for(int x = 0; x < str.size(); x++)
c.push_back(str[x]);
}
vector<char> data(){
return c;
}
};
ostream operator<<(ostream & stream, C & in){
for(int x = 0; x < in.data().size(); x++)
stream << in.data()[x];
return stream;
}
istream operator>>(istream & stream, C & in){
// ???
// what kind of loop?
}