Add a polymorphic_ptr<T> smart pointer data type. It's a somewhat silly
unique ownership smart pointer which is *deep* copyable by assuming it can call a T::clone() method to allocate a copy of the owned data. This is mostly useful with containers or other collections of uniquely owned data in C++98 where they *might* copy. With C++11 we can likely remove this in favor of move-only types and containers wrapped around those types. llvm-svn: 194315
Showing
- llvm/include/llvm/ADT/polymorphic_ptr.h 117 additions, 0 deletionsllvm/include/llvm/ADT/polymorphic_ptr.h
- llvm/unittests/ADT/CMakeLists.txt 1 addition, 0 deletionsllvm/unittests/ADT/CMakeLists.txt
- llvm/unittests/ADT/polymorphic_ptr_test.cpp 71 additions, 0 deletionsllvm/unittests/ADT/polymorphic_ptr_test.cpp
llvm/include/llvm/ADT/polymorphic_ptr.h
0 → 100644
llvm/unittests/ADT/polymorphic_ptr_test.cpp
0 → 100644
Please register or sign in to comment