Which string classes to use in C++?

后端 未结 7 2158
遇见更好的自我
遇见更好的自我 2021-02-02 14:30

we have a multi-threaded desktop application in C++ (MFC). Currently developers use either CString or std::string, probably depending on their mood. So we\'d like to choose a s

7条回答
  •  花落未央
    2021-02-02 14:39

    I would suggest making a "per DLL" decision. If you have DLLs depending heavily on MFC (for example, your GUI layer), where you need a lot of MFC calls with CString parameters, use CString. If you have DLLs where the only thing from MFC you are going to use would be the CString class, use std::string instead. Of course, you will need conversion function between both classes, but I suspect you have already solved that issue.

提交回复
热议问题