Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Parser.h
- #pragma once
- #include <sstream>
- template<typename T>
- class Parser{
- private:
- std::istream& input;
- std::string stopLine;
- public:
- Parser(std::istream& input, std::string& stopLine) : input(input), stopLine(stopLine){}
- bool readNext(T& toParse){
- this->input >> toParse;
- std::ostringstream s;
- s << toParse;
- if(s.str() == this->stopLine){
- return false;
- }
- return true;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement