It's amazing that std::set be converted to MySet, but how to avoid ?
#include <bits/stdc++.h>
struct MySet : public std::set<int> {
MySet(const std::set<int>& s) {
}
};
std::set<int> get(int i) {
return std::set<int>{i};
}
int main() {
const MySet& a = get(0);
std::cout << a.empty() << std::endl; // true
}
const MySet& a = get(0);
should give compile error.