[llvm] r203387 - [C++11] Add llvm::make_unique, according to N3656.

Chandler Carruth chandlerc at google.com
Sun Mar 9 04:43:59 PDT 2014


On Sun, Mar 9, 2014 at 4:20 AM, Ahmed Charles <ahmedcharles at gmail.com>wrote:

> +/// Implement make_unique according to N3656.
>
+///
> +/// template<class T, class... Args> unique_ptr<T> make_unique(Args&&...
> args);
> +/// Remarks: This function shall not participate in overload resolution
> unless
> +///          T is not an array.
> +/// Returns: unique_ptr<T>(new T(std::forward<Args>(args)...)).
> +///
> +/// template<class T> unique_ptr<T> make_unique(size_t n);
> +/// Remarks: This function shall not participate in overload resolution
> unless
> +///          T is an array of unknown bound.
> +/// Returns: unique_ptr<T>(new typename remove_extent<T>::type[n]()).
> +///
> +/// template<class T, class... Args> unspecified make_unique(Args&&...) =
> delete;
> +/// Remarks: This function shall not participate in overload resolution
> unless
> +///          T is an array of known bound.
>

I don't really think this really helps as the doxygen for this routine....
And it would be better to attach the documentation to the specific routines
in question and use the standard doxygen format (brief description,
detailed, etc) with boring prose.

+///
> +/// Use scenarios:
> +///
> +/// Single object case:
> +///
> +/// auto p0 = make_unique<int>();
> +///
> +/// auto p2 = make_unique<std::tuple<int, int>>(0, 1);
> +///
> +/// Array case:
> +///
> +/// auto p1 = make_unique<int[]>(2); // value-initializes the array with
> 0's.
> +///
>

These are useful to include, but like above should be attached to the
specific interface to which they apply. Also, make sure they're set up to
be rendered as code in doxygen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140309/851927b1/attachment.html>


More information about the llvm-commits mailing list