This question already has answers here:
How to overload the conditional operator? [duplicate]
                                
                                    (3个答案)
                                
                        
                                4年前关闭。
            
                    
如何在C ++中重载此比较运算符?

(statement)?(if true):(if false)

最佳答案

您不能(§13.5/ 3):


  以下运算符不能重载:
  . .* :: ?:
  预处理符号也不能
  #
  和
  ##
  (条款
   16)。

关于c++ - 如何在C++中重载三元运算符(?:)? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33097853/

10-11 22:45
查看更多