c++ namespace best practice dilemma

后端 未结 6 1986
遥遥无期
遥遥无期 2021-01-31 03:55

I\'m finding that what I\'ve considered \"best practice\" for use namespace in c++ is hurting the readability of my code, and making me question how to use them well.

My

6条回答
  •  清酒与你
    2021-01-31 04:33

    My experience have been that it is much more convenient to have one namespace for all your code for the reasons you mentioned in your original post. This namespace protects your identifiers from clashing with identifiers from 3rd-party libraries. Your namespace is your dominion and it is easy to keep it name-conflict-free.

提交回复
热议问题