Visual Studio 和 Xcode 之间的 Chaiscript 字符串问题

Chaiscript string problem between Visual Studio and Xcode

我遇到了一个非常奇怪的错误,或者很可能是我遗漏了什么。我的脚本在使用 VS 2015 编译时运行完美,但在我切换到 Mac 并使用 Xcode 9.

时失败

问题是,在 Mac,chaiscript 删除了返回字符串的开头。我不知道为什么?这是问题所在: 在 C++ 方面,我有一个像这样的 class 连接到 API 并在 JSONString:

中存储 API 回复
class MyClass
{
  public string JSONString;
  public void Get(URL);
}

此 class 从 chaiscript 实例化并包含 JSON 数据。这是代码:

def GetAPIData()
{
  var myurl = "Https://api.domain.com";
  auto &request = MyClass();
  request.Get(myurl);
  return request.JSONString;
}

var response = GetAPIData();

当我从 GetAPIData 记录字符串时,在 Windows 上它是这样的:

[{"id": 91, "name": "aaa", "status": "Active"}, {"id": 2, "name": "bbb", "status": "Active"}]

在 Mac:

: "aaa", "status": "Active"}, {"id": 2, "name": "bbb", "status": "Active"}]

为什么会这样?

我很确定这是一个错误。我能够通过用 to_string().

包装 request.JSONString 来解决这个问题
def GetAPIData()
{
  var myurl = "Https://api.domain.com";
  auto &request = MyClass();
  request.Get(myurl);
  return to_string(request.JSONString);
}