相关疑难解决方法(0)

BOOST_CHECK无法为自定义类型编译operator <<

我写了这个非常琐碎的课程,以便清楚我的问题是什么:

class A
{
public:
    int x;
    A(int y) {x=y;}
    bool operator==(const A &other) const {return x==other.x;}
};
Run Code Online (Sandbox Code Playgroud)

现在,如果我定义A first(1)和A second(1),那么BOOST_CHECK_EQUAL(第一个,第二个)应该通过似乎很自然.然而,当我尝试这样做时,我得到了50个错误,第一个听起来像:没有数学运算符<<在ostr << t这是升级代码中的某个地方...其他测试工作正常,比较已知类型甚至指针,但是类对象似乎发生了一些不同的事情.

c++ boost unit-testing

8
推荐指数
2
解决办法
3724
查看次数

标签 统计

boost ×1

c++ ×1

unit-testing ×1