../UniqueStrTest/main.cpp: In function ‘int main(int, char**)’:
../UniqueStrTest/main.cpp:35:25: error: ‘make_unique’ is not a member of ‘std’
auto p = std::make_unique<D>(); // p 是占有 D 的 unique_ptr
^~~~~~~~~~~
make_unique从c++14开始,c++11不支持,但是可以自己实现make_unique
/// std::make_unique for single objects
template<typename _Tp, typename... _Args>
inline typename _MakeUniq<_Tp>::__single_object
make_unique(_Args&&... __args)
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
/// std::make_unique for arrays of unknown bound
template<typename _Tp>
inline typename _MakeUniq<_Tp>::__array
make_unique(size_t __num)
{ return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__num]()); }
/// Disable std::make_unique for arrays of known bound
template<typename _Tp, typename... _Args>
inline typename _MakeUniq<_Tp>::__invalid_type
make_unique(_Args&&...) = delete;