Take this example: http://www.cppsamples.com/common-tasks/shared-ownership.html … why take the shared pointer by value? It's use is scoped. If you store it off, then copy it to
-
-
-
To that shared pointer and it's all good. But the extra add ref and remove ref seems unnecessary.
Keskustelun loppu
Uusi keskustelu -
-
-
@MachineLinguist the lifetime of the function is less than that of the outer shared pointer. Unless you are multithreading very poorly. -
@MachineLinguist so why bother with another add ref and remove ref? Like, if your most outer scope of the shared ptr has a ref, all inner - Näytä vastaukset
Uusi keskustelu -
-
-
@MachineLinguist actually, I will agree with your last statement. -
@MachineLinguist kind of. I think there is value in keeping an object "in the system" and not letting it out to be handled raw.
Keskustelun loppu
Uusi keskustelu -
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.