Skip to content

Commit

Permalink
derive bad_lexical_cast from std::exception
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed May 18, 2014
1 parent 228b2af commit 2aebad5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/util.hpp
Expand Up @@ -73,7 +73,14 @@ inline double round_portable(double d) {
return (d >= 0.0) ? std::floor(d + 0.5) : std::ceil(d - 0.5);
}

struct bad_lexical_cast {};
struct bad_lexical_cast : std::exception
{
public:
const char *what() const throw()
{
return "bad_lexical_cast";
}
};

template<typename To, typename From>
To lexical_cast(From a)
Expand Down

0 comments on commit 2aebad5

Please sign in to comment.