Why do i get "Cannot open file: /src/gcc-5.1.0/libgcc/unwind-seh.c" when std::length_error is thrown? Here is code:
void User_Account::set_username(string name)
{
if(!is_valid(name))throw length_error("Length has to be greater than 8");
username =name;
}
void User_Account::set_password(string pass)
{
pwd = pass;
}
//helper functions
bool is_valid(const string& s)
{
const string::size_type acceptable_size = 8;
return s.size() >= acceptable_size;
}
main:
try
{
newuser.set_password(password);
newuser.set_username(username);
}
catch(const length_error& e)
{
cerr<<e.what();
}
Aucun commentaire:
Enregistrer un commentaire