optmize std::map comparison

This commit is contained in:
Mathieu Lacage committed 2006-12-12 14:41:52 +01:00
1 parent 6e0bc0ef9b
commit 262d09de55
2 files changed
+8 -4

No files matched your search

+7 -3
View File
@@ -49,16 +49,20 @@ SchedulerMap::~SchedulerMap ()
* - transitivity: f(x,y) and f(y,z) => f(x,z)
*/
bool
SchedulerMap::EventKeyCompare::operator () (struct EventKey a, struct EventKey b)
SchedulerMap::EventKeyCompare::operator () (struct EventKey const&a, struct EventKey const&b)
{
if (a.m_ns < b.m_ns)
{
return true;
}
else if (a.m_ns == b.m_ns && a.m_uid < b.m_uid)
else if (a.m_ns > b.m_ns)
{
return false;
}
else if (a.m_uid < b.m_uid)
{
return true;
}
}
else
{
return false;
+1 -1
View File
@@ -47,7 +47,7 @@ private:
class EventKeyCompare {
public:
bool operator () (struct EventKey a, struct EventKey b);
bool operator () (struct EventKey const&a, struct EventKey const&b);
};
typedef std::map<Scheduler::EventKey, EventImpl*, SchedulerMap::EventKeyCompare> EventMap;