How would I create a function that can read values from a file into multiple numbers of variables varying from 1 to many?
Here's what I have so far, working from a similar question.
Note: I cannot use fold expressions (file >> ... >>> x) because the code uses C++ 14.
test_stream_file Contents:
teststring_a    teststring_b
Code:
template<typename... Args>
void fileread(std::fstream& file, Args...args)
{
    using expander = int[];
    expander{ (file >> (std::forward<Args>(args)), 0)... };
}
int main() {
    std::fstream teststream;
    teststream.open("test_stream_file", std::ios::in);
    std::string a, b;
    fileread(teststream, a, b);
    std::cout << a << b;
}
When I run this I get error C2679: "binary '>>': no operator found which takes a right hand operator of type '_Ty' (or there is no acceptable conversion)". I'm a bit lost here. I read the documentation and another answer on std::forward but am still not seeing what is going wrong.
 
     
    