Use operator overloading best practices.

Not all files covered.

Refer to StackOverflow for details: http://stackoverflow.com/a/4421719
This commit is contained in:
Jason Felds
2014-11-26 14:51:21 -05:00
parent 1a51b06934
commit 3451b2f2d5
10 changed files with 218 additions and 97 deletions
+9 -1
View File
@@ -40,7 +40,6 @@ struct File
dir=false; size=-1; hash=-1; priv=NULL; dirp=NULL;
}
bool operator== (const File &rhs) const { return lname==rhs.lname; }
bool operator< (const File &rhs) const { return lname<rhs.lname; }
bool equal(const File &rhs) const { return lname == rhs.lname; }
@@ -52,6 +51,15 @@ struct File
}
};
inline bool operator==(File const &lhs, File const &rhs)
{
return lhs.lname == rhs.lname;
}
inline bool operator!=(File const &lhs, File const &rhs)
{
return !operator==(lhs, rhs);
}
/** @brief This represents a directory. */
struct FileSet
{