ddovod / jet-live

c++ hot code reload for linux and macos
MIT License
411 stars 23 forks source link

[Newbie Question] Why wrap in std::unique_ptr? #12

Closed codecnotsupported closed 5 years ago

codecnotsupported commented 5 years ago

What is the purpose behind using ::make_unique so much? For example:

Why auto live = jet::make_unique(std::move(listener), config); Instead of something like. jet::Live live(listener,config);

Cool project by the way.

ddovod commented 5 years ago

Hey! Thank you very much.

Actually there's no any hidden meaning under the unique_ptr here, you can create an instance of Live class on the stack if you want. In my application I store this instance in the service locator using unique_ptr, so I use it here just out of habit, no more.

ddovod commented 5 years ago

Looks like it's clear now, closing. Please reopen if you have any questions.