I am trying to take input from command prompt and put every input separated by white-space or tab to vector until user presses "enter". I am not able to do do. here is my code
template <typename T>
vector <T> process_input_stream() {
T value;
vector <T> vect;
string line;
//read input and populate into vect until return key is pressed
while (getline(cin, line, '\n')){
cin >> value;
std::cin.clear();
std::cin.ignore(std::numeric_limits<streamsize>::max(), '\n');
vect.push_back(value);
}
return vect;
}
now the problem i am hitting my head to, is, when entering input, input is screen is still asking for more input even after pressing enter key.