Skip to content

Basic: out-of-line equality operator (NFCI) #29032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions include/swift/Basic/Located.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ namespace swift {
/// the ClangImporter needs to keep track of where imports were originally written.
/// Located makes it easy to do so while making the code more readable, compared to
/// using `std::pair`.
template<typename T>
template <typename T>
struct Located {

/// The main item whose source location is being tracked.
T Item;

Expand All @@ -45,13 +44,13 @@ struct Located {

SWIFT_DEBUG_DUMP;
void dump(raw_ostream &os) const;

template<typename U>
friend bool operator ==(const Located<U> &lhs, const Located<U> &rhs) {
return lhs.Item == rhs.Item && lhs.Loc == rhs.Loc;
}
};

template <typename T>
bool operator ==(const Located<T> &lhs, const Located<T> &rhs) {
return lhs.Item == rhs.Item && lhs.Loc == rhs.Loc;
}

} // end namespace swift

namespace llvm {
Expand Down