有没有办法避免错误 C2039:“value”:不是“boost::proto”的成员?

Obj*_*own 4 c++ boost cpp-netlib vcpkg visual-studio-2019

我正在使用它boost::network::uri::encoded()来编码我的请求 URL。
但是当我构建项目时,我看到了错误:

error C2039: "value": Is not a member of "boost::proto"
Run Code Online (Sandbox Code Playgroud)

其中有四个,他们的报道来自:

boost\proto\generate.hpp(239,20);
boost\proto\generate.hpp(239,53);
boost\proto\generate.hpp(248,20);
boost\proto\generate.hpp(248,53)
Run Code Online (Sandbox Code Playgroud)

这是我的测试代码:

#include <iostream>
#include <string>
#include "boost/network/uri.hpp"
using std::string;
string EncodeURL(string str)
{
    return boost::network::uri::encoded(str);
}
string DecodeURL(string str)
{
    return boost::network::uri::decoded(str);
}
int main()
{
    EncodeURL("https://test.com/a+a+a.html");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我安装boostcpp-netlib使用了vcpkg。我的IDE是Visual Studio Professional 2019,操作系统是Windows 10 Professional Workstation x64(Ver.2004)。
我想知道如何避免这些错误或使用其他方法对 UNICODE 兼容的 URL 进行编码。

Obj*_*own 5

这是boost库的一个bug。可以通过将 boost 库更新到最新版本或编辑来修复boost\proto\generate.hpp

编辑方式boost\proto\generate.hpp

将第 95 行更改为

#if BOOST_WORKAROUND(BOOST_MSVC, < 1800)
Run Code Online (Sandbox Code Playgroud)

将第 233 行更改为

#if BOOST_WORKAROUND(BOOST_MSVC, < 1800)
Run Code Online (Sandbox Code Playgroud)

这是来自 boost 库的PR