27 Jun
2019
27 Jun
'19
3:51 p.m.
On 6/27/19 6:46 PM, Zach Laine via Boost wrote:
On Wed, Jun 26, 2019, 11:12 PM JeanHeyd Meneide via Boost < boost@lists.boost.org> wrote:
using bop = boost::out_ptr;
std::unique_ptr
upNumf; int ret = posix_memalign(bop::out_ptr (upNumf), 64, nNumf); if (ret != 0) { throw std::runtime_error("something went wrong, but at least we're not leaking memory here."); } Casting support is built in to the API: you can go from strongly typed pointers to void**, or other related pointers by passing the type as a template argument.
These seem like they would make good examples for the docs.
Note that in case of posix_memalign you're not leaking memory even without out_ptr.