How to differentiate (when overloading) between prefix and postfix forms of operator++? (C++)

前端 未结 4 1568
眼角桃花
眼角桃花 2020-12-03 16:05

Because I\'ve overloaded the operator++ for an iterator class

template
typename list::iterator& list::it         


        
4条回答
  •  醉梦人生
    2020-12-03 16:36

    Write a version of the same operator overload, but give it a parameter of type int. You don't have to do anything with that parameter's value.

    If you're interested in some history of how this syntax was arrived out, there's a snippet of it here.

提交回复
热议问题