Add Song() != operator
This commit is contained in:
@@ -1357,6 +1357,10 @@ bool Song::operator==(const Song &other) const {
|
|||||||
return url() == other.url() && beginning_nanosec() == other.beginning_nanosec();
|
return url() == other.url() && beginning_nanosec() == other.beginning_nanosec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Song::operator!=(const Song &other) const {
|
||||||
|
return id() != other.id() || url() != other.url() || beginning_nanosec() != other.beginning_nanosec();
|
||||||
|
}
|
||||||
|
|
||||||
uint qHash(const Song &song) {
|
uint qHash(const Song &song) {
|
||||||
// Should compare the same fields as operator==
|
// Should compare the same fields as operator==
|
||||||
return qHash(song.url().toString()) ^ qHash(song.beginning_nanosec());
|
return qHash(song.url().toString()) ^ qHash(song.beginning_nanosec());
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ class Song {
|
|||||||
bool IsSimilar(const Song &other) const;
|
bool IsSimilar(const Song &other) const;
|
||||||
|
|
||||||
bool operator==(const Song &other) const;
|
bool operator==(const Song &other) const;
|
||||||
|
bool operator!=(const Song &other) const;
|
||||||
|
|
||||||
// Two songs that are on the same album will have the same AlbumKey.
|
// Two songs that are on the same album will have the same AlbumKey.
|
||||||
// It is more efficient to use IsOnSameAlbum, but this function can be used when you need to hash the key to do fast lookups.
|
// It is more efficient to use IsOnSameAlbum, but this function can be used when you need to hash the key to do fast lookups.
|
||||||
|
|||||||
Reference in New Issue
Block a user