std::string in a multi-threaded program

后端 未结 8 1799
北恋
北恋 2020-11-30 02:34

Given that:

1) The C++03 standard does not address the existence of threads in any way

2) The C++03 standard leaves it up to implementations to decide whethe

8条回答
  •  Happy的楠姐
    2020-11-30 03:15

    I regulate the string access:

    • make std::string members private
    • return const std::string& for getters
    • setters modify the member

    This has always worked fine for me and is correct data hiding.

提交回复
热议问题