У меня есть
Код: Выделить всё
std::variantКод: Выделить всё
class a {
public:
int* placeholder;
a(a& _copy) { /* Does a deep copy */ }
}
class b {
// For demonstrational purposes, identical to a.
}
int main() {
std::vector instances = // initialise vector, guaranteed no nullptrs.
}
Код: Выделить всё
instances.push_back(instances[0])Код: Выделить всё
vectorOf course, the obvious solution would be to check for all alternatives, then
Код: Выделить всё
get_ifI am also open to solutions that do not use variants.
Источник: https://stackoverflow.com/questions/781 ... nters-in-c
Мобильная версия