You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
struct element {
element() = default;
element(const element&) = delete;
element& operator=(const element&) = delete;
int a_ = 0;
};
struct container {
static container* getInstance() {
static container con;
return &con;
}
void insert(std::unique_ptr<element>& ele) {
elements_.emplace_back(std::move(ele));
}
private:
container() = default;
std::vector<std::unique_ptr<element>> elements_;
};
PYBIND11_MODULE(test, m) {
py::class_<container>(m, "Container")
.def_static("getInstance", &container::getInstance, py::return_value_policy::reference)
.def("insert", &container::insert);
}
why these code can't be compiled? i fell confused QAQ
Beta Was this translation helpful? Give feedback.
All reactions