+ /**
+ * Constructor takes ownership and reports an error if NULL.
+ *
+ * This constructor is intended to be used with other-class constructors
+ * that may report a failure UErrorCode,
+ * so that callers need to check only for U_FAILURE(errorCode)
+ * and not also separately for isNull().
+ *
+ * @param p simple pointer to an array of T objects that is adopted
+ * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
+ * if p==NULL and no other failure code had been set
+ * @stable ICU 56
+ */
+ LocalArray(T *p, UErrorCode &errorCode) : LocalPointerBase<T>(p) {
+ if(p==NULL && U_SUCCESS(errorCode)) {
+ errorCode=U_MEMORY_ALLOCATION_ERROR;
+ }
+ }
+ /**
+ * Move constructor, leaves src with isNull().
+ * @param src source smart pointer
+ * @stable ICU 56
+ */
+ LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
+ src.ptr=NULL;
+ }
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Constructs a LocalArray from a C++11 std::unique_ptr of an array type.
+ * The LocalPointer steals the array owned by the std::unique_ptr.
+ *
+ * This constructor works via move semantics. If your std::unique_ptr is
+ * in a local variable, you must use std::move.
+ *
+ * @param p The std::unique_ptr from which the array will be stolen.
+ * @draft ICU 64
+ */
+ explicit LocalArray(std::unique_ptr<T[]> &&p)
+ : LocalPointerBase<T>(p.release()) {}
+#endif /* U_HIDE_DRAFT_API */
+