Is it allowed to name the parameter in postfix operator ++?

后端 未结 3 622
借酒劲吻你
借酒劲吻你 2021-01-01 11:39

I am not using this code in any production environment, it is just for my understanding. Is this code valid (i.e. can I define my postfix operator like this?):



        
3条回答
  •  再見小時候
    2021-01-01 12:43

    This behavior is legal and well defined in 13.5.7:

    Calling operator++ explicitly, as in expressions like a.operator++(2), has no special properties: The argument to operator++ is 2.

提交回复
热议问题