[ClangImporter] Turn ImportNameVersion into a struct.

...so that we don't have to keep coming back to update it every major
release. And also so we can actually put methods on it instead of
using free functions.

No intended behavior change (yet).
This commit is contained in:
Jordan Rose
2017-09-11 11:15:01 -07:00
parent 90f728a68e
commit 9a04bee421
8 changed files with 144 additions and 148 deletions

View File

@@ -786,6 +786,24 @@ inline OutputIterator transform(const Container &C, OutputIterator result,
return std::transform(C.begin(), C.end(), result, op);
}
/// Provides default implementations of !=, <=, >, and >= based on == and <.
template <typename T>
class RelationalOperationsBase {
public:
friend bool operator>(const T &left, const T &right) {
return right < left;
}
friend bool operator>=(const T &left, const T &right) {
return !(left < right);
}
friend bool operator<=(const T &left, const T &right) {
return !(right < left);
}
friend bool operator!=(const T &left, const T &right) {
return !(left == right);
}
};
} // end namespace swift
#endif // SWIFT_BASIC_INTERLEAVE_H