stlab / libraries

ASL libraries will be migrated here in the stlab namespace, new libraries will be created here.
https://stlab.cc
Boost Software License 1.0
660 stars 65 forks source link

Extra Copy of Object in Future Somewhere #504

Open KevinHopps opened 1 year ago

KevinHopps commented 1 year ago

I have some code that returns a future object of my class vm::page_t and my internal bookkeeping tells me that there are two copies of thing when this continuation is called. If I set a breakpoint in its copy constructor, for example, I can see it being called from boost::optional_detail::optional_base<vm::page_t>::construct(vm::page_t const&)

f.then([](vm::page_t thing) { /* there is another copy of thing somewhere */ });

This may not seem like a big deal, because all of the copies are eventually destroyed, but this class depends on the number of copies being accurate.