nridge added a comment.

`unique_ptr` is harder to get to work than it might appear at first blush :)

Looking at the gcc 6 libstdc++ implementation as an example: the declared 
return type is not `T*`, but `unique_ptr<T>::pointer`. The declaration of that 
is in turn:

  typedef typename _Pointer::type pointer;

The definition of `_Pointer` is in turn:

  // use SFINAE to determine whether _Del::pointer exists
  class _Pointer
  {
    template<typename _Up>
    static typename _Up::pointer __test(typename _Up::pointer*);
  
    template<typename _Up>
    static _Tp* __test(...);
  
    typedef typename remove_reference<_Dp>::type _Del;
  
  public:
    typedef decltype(__test<_Del>(0)) type;
  };

Writing heuristics that see through all that might be possible, and I'm happy 
to explore it, but definitely in a follow-up.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71240/new/

https://reviews.llvm.org/D71240



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to