#include <iostream>
#include <memory>
template<class T, class... Types>
inline auto make_unique(Types&&... Args) -> typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
{
return (std::unique_ptr<T>(new T(std::forward<Types>(Args)...)));
}
template<class T>
inline auto make_unique(size_t Size) -> typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0, std::unique_ptr<T>>::type
{
return (std::unique_ptr<T>(new typename std::remove_extent<T>::type[Size]()));
}
int main()
{
auto test1 = make_unique<int[]>(10); // create an array of 10 ints
auto test2 = make_unique<int>(10); // create a single int with a value of 10
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5PgoKdGVtcGxhdGU8Y2xhc3MgVCwgY2xhc3MuLi4gVHlwZXM+CmlubGluZSBhdXRvIG1ha2VfdW5pcXVlKFR5cGVzJiYuLi4gQXJncykgLT4gdHlwZW5hbWUgc3RkOjplbmFibGVfaWY8IXN0ZDo6aXNfYXJyYXk8VD46OnZhbHVlLCBzdGQ6OnVuaXF1ZV9wdHI8VD4+Ojp0eXBlCnsKICAgIHJldHVybiAoc3RkOjp1bmlxdWVfcHRyPFQ+KG5ldyBUKHN0ZDo6Zm9yd2FyZDxUeXBlcz4oQXJncykuLi4pKSk7Cn0KCnRlbXBsYXRlPGNsYXNzIFQ+CmlubGluZSBhdXRvIG1ha2VfdW5pcXVlKHNpemVfdCBTaXplKSAtPiB0eXBlbmFtZSBzdGQ6OmVuYWJsZV9pZjxzdGQ6OmlzX2FycmF5PFQ+Ojp2YWx1ZSAmJiBzdGQ6OmV4dGVudDxUPjo6dmFsdWUgPT0gMCwgc3RkOjp1bmlxdWVfcHRyPFQ+Pjo6dHlwZQp7CiAgICByZXR1cm4gKHN0ZDo6dW5pcXVlX3B0cjxUPihuZXcgdHlwZW5hbWUgc3RkOjpyZW1vdmVfZXh0ZW50PFQ+Ojp0eXBlW1NpemVdKCkpKTsKfQoKaW50IG1haW4oKQp7CiAgICBhdXRvIHRlc3QxID0gbWFrZV91bmlxdWU8aW50W10+KDEwKTsgLy8gY3JlYXRlIGFuIGFycmF5IG9mIDEwIGludHMKICAgIGF1dG8gdGVzdDIgPSBtYWtlX3VuaXF1ZTxpbnQ+KDEwKTsgLy8gY3JlYXRlIGEgc2luZ2xlIGludCB3aXRoIGEgdmFsdWUgb2YgMTAKICAgIAogICAgcmV0dXJuIDA7Cn0K