这不可能行的……
C++这个三元运算也是有返回类型的。你不可能将两个不兼容的类型同时“auto”
【 在 DoorWay (DoorWay) 的大作中提到: 】
: 标 题: Re: 怎么简洁的实现函数中变参数类型
: 发信站: 水木社区 (Wed Jan 20 07:03:32 2021), 站内
:
: auto it = b ? A: B;
: while(it++ != end)
: // blabla
: 【 在 miui 的大作中提到: 】
: : 比如我有一个函数,如果bRecursive为true,则
: : namespace fs = std::filesystem;
: : foo(const std::string& strPath, const bRecursive)
: : ...................
: --
:
: ※ 来源:·水木社区
http://m.newsmth.net·[FROM: 1.85.207.*]
--
FROM 76.126.252.*