I was just trying to use make_unique function of c++11 on Xcode5.0.2, The Clang version is
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
After checking <memory> It looks like it is not there. make_shared is.
I know this is C++14, but it was also one of the first function validated for c++14. It is even in Visual :).
When will it be available?
Note: more a comment than an answer, but formatted code and comments do not mix.
Unfortunately, no idea when it will be available; however you can easily define it yourself for now and just switch to the standard one later:
template <typename T, typename... Args>
auto make_unique(Args&&... args) -> std::unique_ptr<T>
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
That's it, contrary to make_shared there is no magic here because the benefit is just one of exception safety (tie together allocation and capture in unique_ptr) whereas make_shared bundles additional advantages (irrelevant to unique_ptr).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With