#include template T MenuDriver::read(const std::string& prompt) { bool valid = false; bool surpressNextPrompt = false; T val; while (!valid) { if (surpressNextPrompt) surpressNextPrompt = false; // turn off else if (prompt.size()) std::cout << prompt; std::string response; *isr >> response; // getline(*isr, response); if (isr->eof()) { switchInput(); surpressNextPrompt = true; } else { // successful so far if (isr != &std::cin) // echo input std::cout << response << "\n"; std::stringstream sstr; sstr << response; sstr >> val; valid = !sstr.fail(); } } return(val); }