ifstream . A(std::ifstream input) " A, ifstream ". , , .
( " , ".) A(std::ifstream& input). , "" , , " , ".
: while, A(input);, A, while. , , ? , - A, :
static void process(std::istream& stream)
{
}
int main()
{
std::ifstream input("somefile.xxx");
while (input.good())
{
process(input);
}
return 0;
}
struct A
{
A()
{
}
void process(std::istream& stream)
{
}
};
int main()
{
std::ifstream input("somefile.xxx");
A something;
while (input.good())
{
something.process(input);
}
return 0;
}