Boost C++ Libraries: Ticket #13165: inplace_ptr https://svn.boost.org/trac10/ticket/13165 <p> Boost.Optional uses in place object creation. In many cases it could used as a drop in repelacment of scoped_ptr with the benefit of circumventing a memory allocation and locality of memory access. </p> <p> However its semantics is 'optional' and not like a fast replacement of scoped_ptr. Wouldn't it be an idea to add something like this to the smart_ptr library? Names can be e.g. inplace_ptr, value_ptr, etc. We could also use Boost.Optional but colleagues might get confused, since you do not use the 'optional' aspect but its performance aspect. </p> <p> Note that people might wonder why not use value based directly, but there are still some use cases: </p> <ul><li>for pimpl idiom / hide expansive headers (e.g. multi index) in client </li><li>2 phase construction, where information is not yet available at parent constructor time. </li></ul><p> Only drawback is that you lose polymorphism. </p> <p> <a class="ext-link" href="https://stackoverflow.com/questions/22636407/why-not-use-boostoptional-as-a-better-scoped-ptr"><span class="icon">​</span>https://stackoverflow.com/questions/22636407/why-not-use-boostoptional-as-a-better-scoped-ptr</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13165 Trac 1.4.3 gast128 <gast128@…> Sun, 03 Sep 2017 18:22:28 GMT <link>https://svn.boost.org/trac10/ticket/13165#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13165#comment:1</guid> <description> <p> ...the pimpl idiom can't be solved with this; it needs the definition anyway. </p> </description> <category>Ticket</category> </item> </channel> </rss>