From d648754b1f35e7a6465869157ae9afa0b0ee451d Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Wed, 1 Jul 2015 19:17:50 +0200 Subject: Overload operator== for each tag individually --- src/tag_compound.cpp | 12 +++++++++++- src/tag_string.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tag_compound.cpp b/src/tag_compound.cpp index 20cb021df8..53fd9df8ac 100644 --- a/src/tag_compound.cpp +++ b/src/tag_compound.cpp @@ -91,7 +91,17 @@ std::unique_ptr tag_compound::move_clone() && bool tag_compound::equals(const tag& rhs) const { - return tags == static_cast(rhs).tags; + return *this == static_cast(rhs); +} + +bool operator==(const tag_compound& lhs, const tag_compound& rhs) +{ + return lhs.tags == rhs.tags; +} + +bool operator!=(const tag_compound& lhs, const tag_compound& rhs) +{ + return !(lhs == rhs); } } diff --git a/src/tag_string.cpp b/src/tag_string.cpp index 6322d4a42c..b3ef075cd3 100644 --- a/src/tag_string.cpp +++ b/src/tag_string.cpp @@ -79,7 +79,17 @@ std::unique_ptr tag_string::move_clone() && bool tag_string::equals(const tag& rhs) const { - return value == static_cast(rhs).value; + return *this == static_cast(rhs); +} + +bool operator==(const tag_string& lhs, const tag_string& rhs) +{ + return lhs.get() == rhs.get(); +} + +bool operator!=(const tag_string& lhs, const tag_string& rhs) +{ + return !(lhs == rhs); } } -- cgit 0.0.5-2-1-g0f52