이전에 언급 한 작업을 수행하기 위해 STL 맵을 사용하고 있습니다.문자열별로 CMap 키 정렬
struct ltstr
{
bool operator()(std::string s1, std::string s2) const
{
const int l1 = s1.length();
const int l2 = s2.length();
if (l1 == l2) {
// In alphabetical order.
return s1.compare(s2) < 0;
}
// From longest length to shortest length.
return l1 > l2;
}
};
std::map<std::string, int, ltstr> m;
CMap을 사용하여 동일한 작업을 수행하려면 어떻게해야합니까?
// How to make key sorted by string length?
CMap<CString, LPCTSTR, int, int> m;
나는'CMap'이 실제로 해시 맵이고 따라서 순서를 제공하지 않는다고 확신한다. – GManNickG