[PATCH] unique_ptr with ability to get a raw pointer after release.

Антон Ярцев anton.yartsev at gmail.com
Mon Sep 22 11:12:35 PDT 2014


Hi dblaikie,

The work is inspired by r215176 and comment to r217791.
unique_ptr_deferred_release is intended for use in cases when conditional releases are mixed with raw pointer access, e.g:

    unique_ptr_deferred_release<Type> P(new P);
    if (cond) {
      P.deferred_release();
    }
    assert(P.get()); // 'true' regardless of whether deferred_release() was called or not.
    NonOwningFunction(P.get());

Please review!

http://reviews.llvm.org/D5443

Files:
  include/llvm/ADT/STLExtras.h
  unittests/ADT/CMakeLists.txt
  unittests/ADT/UniquePtrDeferredRelease.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5443.13942.patch
Type: text/x-patch
Size: 3643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140922/282507ea/attachment.bin>


More information about the llvm-commits mailing list