Skip to content

Resolving Ambiguous Constructor Call in Legacy Vector Initialization

Qiaozhi Lei requested to merge ambiguous-legacy-vector-constructor into master

Description:

When the OPENMESH_VECTOR_LEGACY option is enabled, a compile error is encountered:

error C2668: 'OpenMesh::VectorT<double,3>::VectorT': ambiguous call to overloaded function

The ambiguity arises when initializing with a single scalar, as in Normal n(0). This matches two potential constructors:

  1. OpenMesh::VectorT<double,3>::VectorT(const Scalar [])
  2. OpenMesh::VectorT<double,3>::VectorT(const Scalar &)

To avoid this ambiguity, this PR initializes using three scalars, e.g., Normal n(0,0,0). This approach is also adopted in the calculation of halfedge normals.

Merge request reports