From 7786d32ba580c4aebeab00e5ed1454f65c137773 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 20 Feb 2017 18:10:26 +1100 Subject: [PATCH] view: add inequality operator --- view.cpp | 2 ++ view.hpp | 3 +++ view.ipp | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/view.cpp b/view.cpp index aea0db83..40d011dd 100644 --- a/view.cpp +++ b/view.cpp @@ -31,6 +31,7 @@ util::operator== (A a, B b) \ } +//----------------------------------------------------------------------------- EQUALITY(const std::string&, view) EQUALITY(const std::string&, view) EQUALITY(const std::string&, view) @@ -43,6 +44,7 @@ EQUALITY(view, const std::string&) #undef EQUALITY + /////////////////////////////////////////////////////////////////////////////// namespace util { #define OSTREAM(A) \ diff --git a/view.hpp b/view.hpp index ca6fb705..a9d28b23 100644 --- a/view.hpp +++ b/view.hpp @@ -79,6 +79,9 @@ namespace util { auto make_cview (const T&); + template + bool operator!= (view, view); + bool operator== (const std::string&, view); bool operator== (const std::string&, view); bool operator== (const std::string&, view); diff --git a/view.ipp b/view.ipp index 1c0b75e8..a14691df 100644 --- a/view.ipp +++ b/view.ipp @@ -170,6 +170,15 @@ util::view::operator== (const view rhs) const noexcept } +//----------------------------------------------------------------------------- +template +bool +util::operator!= (const view a, const view b) +{ + return !(a == b); +} + + /////////////////////////////////////////////////////////////////////////////// template auto