String vs CString Source differences

05/01/2020 17:32 VirusAtwar#1
Hey there,
currently trying to make a "proper base source" form a few released ones out there, for testing different things. Ketchup's (Other forum) and Blouflash's for those interested in the particular sources.

Within the "Script.cpp & Script.h"

Lot's of differences like where it's "string" in one source and "CString" in another one, duo to my lack of programming skills, it doesn't make much sense.
My question is, what's the difference between those? I would guess, it doesn't really matter, since the sources work and no complications appear?

Few examples:
Code:
	static map<string, int>		m_defines;
	static map<string, string>	m_mapString;


	static map<CString, int>		m_defines;
	static map<CString,CString>		m_mapString;
Code:
		bool bResult = m_mapString.insert( map<string, string>::value_type( (LPCTSTR)str, (LPCTSTR)Token ) ).second;


		bool bResult = m_mapString.insert( map<CString, CString>::value_type( (LPCTSTR)str, (LPCTSTR)Token ) ).second;

Code:
	CScanner::GetToken( FALSE );
	string str = token;
	CScanner::GetToken( FALSE );


	CScanner::GetToken( FALSE );
	CString str = token;
	CScanner::GetToken( FALSE );
05/01/2020 18:02 Naltalah#2
The main difference is that string, or in this case, std::string is a class provided by the C++ STL, while CString is ATL specific.

I haven't looked into all of the details, but I guess a lot of methods will be different when it comes to concatenating, formating, etc.

They're both just String-Classes, so idk why one source uses CString (which is offi code) and the other one just uses std::string, probably just a matter of personal taste.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]