
#ifndef __STRING_TO_NUMBER_H_INCLUDED__
#define __STRING_TO_NUMBER_H_INCLUDED__

#include <string>
#include <sstream>

template <typename numericType>
numericType StringToNumber(const string& str) {
	stringstream ss(str);
	numericType tmp;
	ss >> tmp;
	if (ss.fail()) {
		string s = "Unable to format ";
		s += str;
		s += " as a number!";
		throw(s);
	}
	return (tmp);
}

#endif //__STRING_TO_NUMBER_H_INCLUDED__
