Function object implementing less-than comparison and hashing by path, to support sorting infos, using them as keys, and other interactions with the STL.
| 106 | /// path, to support sorting infos, using them as keys, and other |
| 107 | /// interactions with the STL. |
| 108 | struct ByPath { |
| 109 | bool operator()(const FileInfo& l, const FileInfo& r) const { |
| 110 | return l.path() < r.path(); |
| 111 | } |
| 112 | |
| 113 | size_t operator()(const FileInfo& i) const { |
| 114 | return std::hash<std::string>{}(i.path()); |
| 115 | } |
| 116 | }; |
| 117 | |
| 118 | protected: |
| 119 | std::string path_; |