Renaming first and second of a map iterator

后端 未结 8 1736
北恋
北恋 2020-12-14 02:41

Is there any way to rename the first and second accessor functions of a map iterator. I understand they have these names because of the underlying pair which represents the

8条回答
  •  执念已碎
    2020-12-14 02:56

    I've got an evil solution!

    #define vertex first
    #define edge second
    

    Although as an evil solution it will doubtless cause great trauma and difficult to diagnose compilation problems when you accidentally use those words elsewhere.

    Added for completeness.

    Can't believe nobody else has suggested this.

提交回复
热议问题