我有以下代码:
#include <iostream>
#include <boost\lexical_cast.hpp>
struct vec2_t
{
float x;
float y;
};
std::istream& operator>>(std::istream& istream, vec2_t& v)
{
istream >> v.x >> v.y;
return istream;
}
int main()
{
auto v = boost::lexical_cast<vec2_t>("1231.2 152.9");
std::cout << v.x << " " << v.y;
return 0;
}
我从 Boost 收到以下编译错误:
错误 1 错误 C2338: 目标类型既不是 std::istream 也
able nor std::wistream
可以
这看起来很简单,在过去的一个小时里,我一直在用头撞桌子。任何帮助,将不胜感激!
编辑:我正在使用 Visual Studio 2013。