@@ -78,22 +78,25 @@ class ITK_TEMPLATE_EXPORT Array : public vnl_vector<TValue>
7878 * the array does not manage the memory of the buffer. It merely points to
7979 * that location and it is the user's responsibility to delete it.
8080 * If "LetArrayManageMemory" is true, then this class will free the
81- * memory when this object is destroyed. */
82- Array (ValueType * datain, SizeValueType sz, bool LetArrayManageMemory = false );
81+ * memory when this object is destroyed.
82+ * \note This constructor supports class template argument deduction (CTAD). */
83+ Array (TValue * datain, SizeValueType sz, bool LetArrayManageMemory = false );
8384
8485#if defined(ITK_LEGACY_REMOVE)
8586 /* * Constructor that initializes array with contents from a user supplied
8687 * const buffer. The pointer to the buffer and the length is specified. By default,
8788 * the array does a deep copy of the const pointer data, so the array class also
88- * manages memory. */
89- Array (const ValueType * datain, SizeValueType sz);
89+ * manages memory.
90+ * \note This constructor supports class template argument deduction (CTAD). */
91+ Array (const TValue * datain, SizeValueType sz);
9092
9193#else // defined ( ITK_LEGACY_REMOVE )
9294 /* * Constructor that initializes array with contents from a user supplied
9395 * buffer. The pointer to the buffer and the length is specified. The array
9496 * does a deep copy of the const pointer data, so the array class also
95- * manages memory. The 3rd argument is only for backward compatibility. */
96- Array (const ValueType * datain, SizeValueType sz, bool LetArrayManageMemory = false );
97+ * manages memory. The 3rd argument is only for backward compatibility.
98+ * \note This constructor supports class template argument deduction (CTAD). */
99+ Array (const TValue * datain, SizeValueType sz, bool LetArrayManageMemory = false );
97100#endif
98101
99102 /* * Constructor to initialize an array from another of any data type */
@@ -208,6 +211,10 @@ class ITK_TEMPLATE_EXPORT Array : public vnl_vector<TValue>
208211 bool m_LetArrayManageMemory{ true };
209212};
210213
214+ // Deduction guide to avoid compiler warnings (-wctad-maybe-unsupported) when using class template argument deduction.
215+ template <typename TValue>
216+ Array (TValue *, typename vnl_vector<TValue>::size_type, bool ) -> Array<TValue>;
217+
211218template <typename TValue>
212219std::ostream &
213220operator <<(std::ostream & os, const Array<TValue> & arr)
0 commit comments