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 @   azureology  阅读(190)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2021-03-05 Ubuntu18.04修改登录页背景(双屏)
点击右上角即可分享
微信分享提示
主题色彩