C++ template to cover const and non-const method

后端 未结 7 1397
北荒
北荒 2020-12-29 22:48

I have a problem with duplication of identical code for const and non-const versions. I can illustrate the problem with some code. Here are two s

7条回答
  •  孤城傲影
    2020-12-29 23:25

    Add visitor trait to tell whether it's modifying or not (const or non-const use). This is used by STL iterators.

提交回复
热议问题