Loading

c++函数忽略某个参数

需求

对于某些函数我们希望再传入多余参数时不做处理
同时我们也不希望不报错,提高兼容性

代码

例如对2D点传入3D坐标进行构造

    /**
     * @brief constructor take x, y, z as parameters where z is nonsense.
     *
     * @note it enables the templated assignment in terms of Point3T
     *
     * @param x x value
     * @param y y value
     */
    Point2T(ScalarType const x, ScalarType const y, ScalarType const /*z*/) noexcept;
posted @ 2022-03-05 14:55  azureology  阅读(203)  评论(0)    收藏  举报