例如
template<class Container, class T>
bool operator==(Container const& c, std::initializer_list<T> const& l)
{
return c.size() == l.size() && equal(c.begin(), c.end(), l.begin());
}
检查
std::vector<int> v = {1, 2};
bool b = operator==(v, {1, 2}); // okay
b = (v == {1, 2}); // Error
为什么呢?以及如何解决它?