change throw() to noexcept to conform to c++11

This commit is contained in:
Omkar Wagh 2016-11-07 13:57:00 -05:00
parent 0e24e3c64f
commit 91c1d23461
3 changed files with 11 additions and 5 deletions

View File

@ -83,10 +83,16 @@
// managable and fixes a set of common hard-to-find bugs. // managable and fixes a set of common hard-to-find bugs.
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
# define JSONCPP_OVERRIDE override # define JSONCPP_OVERRIDE override
#elif defined(_MSC_VER) && _MSC_VER > 1600 # define JSONCPP_NOEXCEPT noexcept
#elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
# define JSONCPP_OVERRIDE override # define JSONCPP_OVERRIDE override
# define JSONCPP_NOEXCEPT throw()
#elif defined(_MSC_VER) && _MSC_VER >= 1900
# define JSONCPP_OVERRIDE override
# define JSONCPP_NOEXCEPT noexcept
#else #else
# define JSONCPP_OVERRIDE # define JSONCPP_OVERRIDE
# define JSONCPP_NOEXCEPT throw()
#endif #endif
#ifndef JSON_HAS_RVALUE_REFERENCES #ifndef JSON_HAS_RVALUE_REFERENCES

View File

@ -53,8 +53,8 @@ namespace Json {
class JSON_API Exception : public std::exception { class JSON_API Exception : public std::exception {
public: public:
Exception(JSONCPP_STRING const& msg); Exception(JSONCPP_STRING const& msg);
~Exception() throw() JSONCPP_OVERRIDE; ~Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
char const* what() const throw() JSONCPP_OVERRIDE; char const* what() const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
protected: protected:
JSONCPP_STRING msg_; JSONCPP_STRING msg_;
}; };

View File

@ -193,9 +193,9 @@ namespace Json {
Exception::Exception(JSONCPP_STRING const& msg) Exception::Exception(JSONCPP_STRING const& msg)
: msg_(msg) : msg_(msg)
{} {}
Exception::~Exception() throw() Exception::~Exception() JSONCPP_NOEXCEPT
{} {}
char const* Exception::what() const throw() char const* Exception::what() const JSONCPP_NOEXCEPT
{ {
return msg_.c_str(); return msg_.c_str();
} }