[LLVMdev] New type of smart pointer for LLVM (original) (raw)

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Oct 2 09🔞17 PDT 2014


On Oct 2, 2014, at 2:43 AM, Anton Yartsev <anton.yartsev at gmail.com> wrote:

I'm still concerned this isn't the right direction, and that we instead want a more formal "maybe owning pointer". The specific use case you've designed for here, in my experience, doesn't seem to come up often enough to justify a custom ADT - but the more general tool of sometimes-owning smart pointer seems common enough (& problematic enough) to warrant a generic data structure (and such a structure would also be appliable to the TGParser use case where this came up). David, could you, please, clarify the concept of the "maybe owning pointer"?

I think the idea is something like the compromise I suggested 1 as an alternative to misusing std::unique_ptr<>. But it's even better to design away "maybe-owning pointers" entirely.



More information about the llvm-dev mailing list