Код: Выделить всё
std::arrayРассмотрим следующий код:
Код: Выделить всё
#include
struct B {
bool operator==(B const&) const {
return true;
}
};
struct C {
bool operator==(C const&) const {
return true;
}
};
struct A1 : B, C {};
struct A2 : B, std::array {};
int main() {
{
auto a = A1{};
auto b = A1{};
auto _ = a == b; // expected error: Member 'operator=='
// found in multiple base classes of different types
}
{
auto a = A2{};
auto b = A2{};
auto _ = a == b; // no error, why?
}
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... uch-a-case
Мобильная версия