这主要是由json_parser_read.hpp里面的一个bug造成的,修改如下代码:     

   struct a_unicode

        {
            context &c;
            a_unicode(context &c): c(c) { }
            void operator()(unsigned long u) const
            {
                //u = (std::min)(u, static_cast<unsigned long>((std::numeric_limits<Ch>::max)()));


                typedef typename std::make_unsigned<Ch>::type UCh;
                u = (std::min)(u, static_cast<unsigned long>((std::numeric_limits<UCh>::max)()));


                c.string += Ch(u);
            }
json
适用于现代 C++ 的 JSON。

        };

如上修改在xcode和visual studio环境下编译正常,但在gcc环境下,可能需要修改typedef typename std::make_unsigned<Ch>::type UCh;为typedef typename make_unsigned<Ch>::type UCh;

GitHub 加速计划 / js / json
43
5
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:6 个月前 )
4424a0fc Signed-off-by: Niels Lohmann <mail@nlohmann.me> 1 天前
11aa5f94 * Make std::filesystem::path conversion to/from UTF-8 encoded JSON string explicit. Signed-off-by: Richard Musil <risa2000x@gmail.com> * Experimental: Changing C++ standard detection logic to accommodate potential corner cases. Signed-off-by: Richard Musil <risa2000x@gmail.com> * Drop C++ standard tests for compilers which do not implement required features. Signed-off-by: Richard Musil <risa2000x@gmail.com> * Drop C++ standard tests for MSVC versions which do not implement required features. Signed-off-by: Richard Musil <risa2000x@gmail.com> --------- Signed-off-by: Richard Musil <risa2000x@gmail.com> Co-authored-by: Richard Musil <risa2000x@gmail.com> 3 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐