Pass Ostream into Istream
I have one function that outputs data into an ostream object, and a
constructor that initializes a class from an istream object in the exact
same format. i.e
std::ostream& operator<<(std::ostream &os, const Matrix &m) {
// Output to os
}
and then
Matrix::Matrix(std::instream& in) {
// Read from in to construct the object
}
so how to I push the output of the first to the input of the second? I
have tried a lot of things, mostly trial and error, but am completely lost
(i.e not even sure what string type to use). Thanks
No comments:
Post a Comment