Fix VS 2012 breakage caused by explicit operator (original) (raw)
Pull request #695 has added an unconditional explicit conversion function to class Json::Value (See json/value.h line 404). This breaks Visual Studio 2012, which understand basic C++11, but not explicit conversion functions (These are supported since VS 2013).
The previous VS 2012 support could be restored by using a similar JSONCPP_XXX approach as has been used for override and noexcept, but this time for the explicit keyword used for conversion functions, for example by defining
#define JSONCPP_OP_EXPLICIT explicit
for fully conforming C++11 compilers and
#define JSONCPP_OP_EXPLICIT
otherwise and then using the JSONCPP_OP_EXPLICITmacro as prefix of the operator bool declaration.
I would create a pull request for this approach, if the basic idea sounds reasonable.