add operator <
This commit is contained in:
@@ -157,6 +157,27 @@ bool operator != (const Mac48Address &a, const Mac48Address &b)
|
||||
return ! (a == b);
|
||||
}
|
||||
|
||||
bool operator < (const Mac48Address &a, const Mac48Address &b)
|
||||
{
|
||||
uint8_t aP[6];
|
||||
uint8_t bP[6];
|
||||
a.CopyTo (aP);
|
||||
b.CopyTo (bP);
|
||||
for (uint8_t i = 0; i < 6; i++)
|
||||
{
|
||||
if (aP[i] < bP[i])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (aP[i] > bP[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, const Mac48Address & address)
|
||||
{
|
||||
uint8_t ad[6];
|
||||
|
||||
@@ -95,6 +95,7 @@ private:
|
||||
|
||||
bool operator == (const Mac48Address &a, const Mac48Address &b);
|
||||
bool operator != (const Mac48Address &a, const Mac48Address &b);
|
||||
bool operator < (const Mac48Address &a, const Mac48Address &b);
|
||||
std::ostream& operator<< (std::ostream& os, const Mac48Address & address);
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
Reference in New Issue
Block a user