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
Actually, the answer may be "It depends". But, if you are using MFC, IMHO, CString usage would be better. Also, you can use CString with STL containers also. But, it will lead to another question, should I use stl containers or MFC containers with CString? Usage of CString will provide agility to your application for example in unicode conversions.
EDIT: Moreover, if you use WIN32 api calls, CString conversions will be easier.
EDIT: CString has a GetBuffer() and regarding methods that allow you to modify buffer directly.
EDIT: I have used CString in our SQLite wrapper, and formatting CString is easier.
bool RS::getString(int idx, CString& a_value) {
//bla bla
if(getDB()->getEncoding() == IDatabase::UTF8){
a_value.Format(_T("%s"), sqlite3_column_text(getCommand()->getStatement(), idx));
}else{
a_value.Format(_T("%s"), sqlite3_column_text16(getCommand()->getStatement(), idx));
}
return true;
}