Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Declare converting Point(v) constructors explicit #3237

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Modules/Core/Common/include/itkPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,30 @@ class ITK_TEMPLATE_EXPORT Point : public FixedArray<TCoordRep, VPointDimension>
Point(const ValueType r[VPointDimension])
: BaseArray(r)
{}
/** Pass-through constructors for single values */

#if defined(ITK_LEGACY_REMOVE)
/** Prevents copy-initialization from `nullptr`, as well as from `0` (NULL). */
Point(std::nullptr_t) = delete;

/** Explicit constructors for single values */
template <typename TPointValueType>
explicit Point(const TPointValueType & v)
: BaseArray(v)
{}
explicit Point(const ValueType & v)
: BaseArray(v)
{}
#else
/** Pass-through constructors for single values
* \note ITK_LEGACY_REMOVE=ON will disallow implicit conversion from a single value. */
template <typename TPointValueType>
Point(const TPointValueType & v)
: BaseArray(v)
{}
Point(const ValueType & v)
: BaseArray(v)
{}
#endif

/** Explicit constructor for std::array. */
explicit Point(const std::array<ValueType, VPointDimension> & stdArray)
Expand Down