This code will not compile in Visual Studio 2015 (15.4.4) with the latest nlohmann::json code:
const nlohmann::json test;
const auto *s = test.get<const std::string*>();
1>F:\rolecraft2\prj\rolecraft\ui\ui_view_character.cpp(13): error C2668: 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get': ambiguous call to overloaded function
1>F:\rolecraft2\ext\nlohmann\json.hpp(9669): note: could be 'const PointerType nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get<const std::string*,0>(void) noexcept const'
1> with
1> [
1> PointerType=const std::string *
1> ]
1>F:\rolecraft2\ext\nlohmann\json.hpp(9657): note: or 'PointerType nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get<const std::string*,0>(void) noexcept'
1> with
1> [
1> PointerType=const std::string *
1> ]
1>F:\rolecraft2\ext\nlohmann\json.hpp(9567): note: or 'ValueType nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::get<const std::string*,const std::string*,0>(void) noexcept(<expr>) const'
1> with
1> [
1> ValueType=const std::string *
1> ]
Seems like Visual Studio's compiler can't decide whether to use ValueType version of get(), or PointerType one. The issue is easily worked around by using get_ptr() instead, but I still would like to report it, as it was working in older versions of the library (2.0.5, for example).
not std::is_pointer<ValueType>::value and
to enable_if template of ValueType get() const noexcept method.
This code will not compile in Visual Studio 2015 (15.4.4) with the latest nlohmann::json code:
The error message is:
Seems like Visual Studio's compiler can't decide whether to use ValueType version of get(), or PointerType one. The issue is easily worked around by using get_ptr() instead, but I still would like to report it, as it was working in older versions of the library (2.0.5, for example).
The issue can be fixed by adding
to enable_if template of ValueType get() const noexcept method.