Which is faster comparision of string or comaprision of enums ?
-
In my code i have too much comparison of strings, is it not a better idea to associate an enum for each string and compare them ? Will this be faster or will it be same as string comparison ? Thanks in advance. :)
-
In my code i have too much comparison of strings, is it not a better idea to associate an enum for each string and compare them ? Will this be faster or will it be same as string comparison ? Thanks in advance. :)
I don't think it's a good idea to associate an enum with every string. If you use "string" or "CString" class type and two string objects will not have same contents(like string1 == "abc" and string2 == "abc"), you can only compare two string's addresses, like "&string1 == &string2" or "string1 != &string2". :)
-
In my code i have too much comparison of strings, is it not a better idea to associate an enum for each string and compare them ? Will this be faster or will it be same as string comparison ? Thanks in advance. :)
Comparing an
enum
will be much faster.Steve