Skip to content

Commit

Permalink
noexcept not added until Visual Studio 2014
Browse files Browse the repository at this point in the history
  • Loading branch information
codemercenary committed Jul 30, 2014
1 parent 4ef83cc commit 1fb9b6d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions contrib/json11/json11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ const Json & static_null() {
* Constructors
*/

Json::Json() noexcept : m_ptr(statics().null) {}
Json::Json(std::nullptr_t) noexcept : m_ptr(statics().null) {}
Json::Json() JSON11_NOEXCEPT : m_ptr(statics().null) {}
Json::Json(std::nullptr_t) JSON11_NOEXCEPT : m_ptr(statics().null) {}
Json::Json(double value) : m_ptr(make_shared<JsonDouble>(value)) {}
Json::Json(int value) : m_ptr(make_shared<JsonInt>(value)) {}
Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {}
Expand Down
15 changes: 13 additions & 2 deletions contrib/json11/json11.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@
#include <memory>
#include <initializer_list>

#ifdef _MSC_VER
// noexcept was added to MSVC in Visual Studio 2014
#if _MSC_VER > 1800
#define JSON11_NOEXCEPT noexcept
#else
#define JSON11_NOEXCEPT throw()
#endif
#else
#define JSON11_NOEXCEPT noexcept
#endif

namespace json11 {

class JsonValue;
Expand All @@ -72,8 +83,8 @@ class Json final {
typedef std::map<std::string, Json> object;

// Constructors for the various types of JSON value.
Json() noexcept; // NUL
Json(std::nullptr_t) noexcept; // NUL
Json() JSON11_NOEXCEPT; // NUL
Json(std::nullptr_t) JSON11_NOEXCEPT; // NUL
Json(double value); // NUMBER
Json(int value); // NUMBER
Json(bool value); // BOOL
Expand Down

0 comments on commit 1fb9b6d

Please sign in to comment.