Skip to content

Commit 04abe38

Browse files
Dani-Hubcdunn2001
authored andcommitted
Issue open-source-parsers#731: Provide new JSONCPP_OP_EXPLICIT macro to restore VS 2012 support after recent introduction of explicit conversion function in JSON::Value.
1 parent edb4bdb commit 04abe38

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

include/json/config.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,23 @@
8484
#if __cplusplus >= 201103L
8585
# define JSONCPP_OVERRIDE override
8686
# define JSONCPP_NOEXCEPT noexcept
87+
# define JSONCPP_OP_EXPLICIT explicit
8788
#elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
8889
# define JSONCPP_OVERRIDE override
8990
# define JSONCPP_NOEXCEPT throw()
91+
# if _MSC_VER >= 1800 // MSVC 2013
92+
# define JSONCPP_OP_EXPLICIT explicit
93+
# else
94+
# define JSONCPP_OP_EXPLICIT
95+
# endif
9096
#elif defined(_MSC_VER) && _MSC_VER >= 1900
9197
# define JSONCPP_OVERRIDE override
9298
# define JSONCPP_NOEXCEPT noexcept
99+
# define JSONCPP_OP_EXPLICIT explicit
93100
#else
94101
# define JSONCPP_OVERRIDE
95102
# define JSONCPP_NOEXCEPT throw()
103+
# define JSONCPP_OP_EXPLICIT
96104
#endif
97105

98106
#ifndef JSON_HAS_RVALUE_REFERENCES

include/json/value.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ Json::Value obj_value(Json::objectValue); // {}
408408
bool empty() const;
409409

410410
/// Return !isNull()
411-
explicit operator bool() const;
411+
JSONCPP_OP_EXPLICIT operator bool() const;
412412

413413
/// Remove all object members and array elements.
414414
/// \pre type() is arrayValue, objectValue, or nullValue

0 commit comments

Comments
 (0)