Hacker News new | ask | show | jobs
by gpderetta 5 days ago
With guaranteed RVO you could do something like this (pseudo-C):

   struct FooBase { ... }
   fn make_foo_base(...) -> FooBase
   struct Foo { base : FooBase; ... }
   fn make_foo(args...) -> Foo {
      return { .base = make_foo_base(...), ... }
   }
1 comments

How is it ensured that make_foo will actually call make_foo_base?
Because it needs a FooBase to give as the value for .base or the struct initialization isn't valid because it doesn't give values for all the members?
You are right, sorry, lost track or the thread.