0
我有一個如下提升遞歸變體。當我使用assert比較兩個遞歸變體對象時,它可以正常工作,但是使用EXPECT_EQ時,會產生編譯錯誤。谷歌測試EXPECT_EQ和boost :: make_recursive_variant
typedef boost::make_recursive_variant<bool, boost::uint8_t, boost::uint32_t,
boost::int32_t, double, std::string, boost::uuids::uuid>::type rvariant_type;
variant_type b1 = true;
rvariant_type b2 = true;
assert(b1 == b2); //work fine
EXPECT_EQ(b1,b2); //gives compiler error.
EXPECT_EQ(boost::get<bool>(b1), boost::get<bool>(b2)); //works fine
升壓/ v1.46.1 /包括/升壓/變體/細節/ variant_io.hpp:64:錯誤:不對應的在「((常量升壓::詳細::變體 '運算符< <': :打印機>> *)this) - > boost :: detail :: variant :: printer >>:out_ < < operand'
這是正確的。這裏也是谷歌測試組的回答。 http://groups.google.com/group/googletestframework/browse_thread/thread/ceed41f2942ffa49備用的是使用EXPECT_TRUE()。 – rjoshi 2011-03-28 11:54:13