T
thinktwice
key_compare can only return true, false , but how about equal happens?
key_compare can only return true, false , but how about equal happens?
key_compare can only return true, false , but how about equal happens?
thinktwice said:thanks, i have customize the compare function, but seems it doesn't
work. is there anything wrong?
struct myVariantCompare{
bool operator()(VARIANT v1, VARIANT v2)
{
if (v1.vt == v2.vt)
{
if (v1.vt == VT_UNKNOWN)
{
CComPtr<IUnknown> spUnk1(v1.punkVal);
if (spUnk1.IsEqualObject(v2.punkVal))
{
return false;
}
else
{
return v1.punkVal < v2.punkVal;
}
}
else
{
//assert, don't support other types
}
}
else
{
return v1.vt < v2.vt;
}
}
};
typedef std::multimap<CComVariant, long , _myVariantCompare> myMap;
typedef myMap::iterator myIter;
myMap map0;
is there any problem with my compare function?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.