示例#1
0
//==============[ operator<(Oid &x,Oid &y) ]=============================
// less than < overloaded
int operator<(const Oid &lhs, const Oid &rhs)
{
  int result;
  // call nCompare with the current
  // Oidx, Oidy and len of Oidx
  if((result = lhs.nCompare(rhs.len(), rhs))<0)  return 1;
  if (result > 0)    return 0;

  // if here, equivalent substrings, call the shorter one <
  return (lhs.len() < rhs.len());
}
示例#2
0
//=============[ int operator == oid,oid ]=================================
// equivlence operator overloaded
int operator==(const Oid &lhs, const Oid &rhs)
{
  // ensure same len, then use nCompare
  if (rhs.len() != lhs.len()) return 0;
  return (lhs.nCompare(rhs.len(), rhs) == 0);
}