Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGLevelObject prevents default construct #16978

Open
RichardYCJ opened this issue May 8, 2024 · 0 comments · May be fixed by #16979
Open

MGLevelObject prevents default construct #16978

RichardYCJ opened this issue May 8, 2024 · 0 comments · May be fixed by #16979

Comments

@RichardYCJ
Copy link
Contributor

Current default ctor of MGLevelObject will call resize() and thus will involve make_shared<Ojbect> during compilation (not really call it at run time).

Hence the following class can not be constructed by default.

class A {
 public:
  A(const int a) : a(a) {}
  int a;
};

MGLevelObject<A> a_list{};  // no matching function for call to A::A()

Actually the MGLevelObject<A> owns std::vector<std::shared_ptr<A>> and can be default constructed.

@RichardYCJ RichardYCJ linked a pull request May 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant