istream& operator>>(istream& in, Money& en_money) { string s1; string s2; double litteral; stringstream buffer; pair ett_par; if(in.peek()!='\n') in >> s1; if(in.peek()!='\n') in >> s2; if(s1 != "") { if(s2 == "") { /*if(en_money.valuta != s2) throw Money::monetary_error("Currency mixing in operator" ,__LINE__);*/ buffer << s1; buffer >> litteral; if(litteral < 0) throw Money::monetary_error("Negative result in operator" ,__LINE__); } else if (s2 != "") { /*if(en_money.valuta != s1) throw Money::monetary_error("Currency mixing in operator" ,__LINE__);*/ buffer << s2; buffer >> litteral; if(litteral < 0) throw Money::monetary_error("Negative result in operator" ,__LINE__); en_money.valuta = s1; } ett_par = double_to_integerpair(litteral); en_money.enheter = ett_par.first; en_money.hundradelar = ett_par.second; } return in; }