From 1f6ab34c3ff65bb1169fd50f0bb15ba35aa238b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffan=20S=C3=B8lvsten?= Date: Wed, 15 Nov 2023 13:41:19 -0500 Subject: [PATCH] Improve performance of comparing requests' target with a single node uid --- src/adiar/internal/data_types/tuple.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/adiar/internal/data_types/tuple.h b/src/adiar/internal/data_types/tuple.h index da03ff4b7..7a58dba69 100644 --- a/src/adiar/internal/data_types/tuple.h +++ b/src/adiar/internal/data_types/tuple.h @@ -363,6 +363,15 @@ namespace adiar::internal inline bool operator> (const tuple &o) const { return (o < *this); } + //////////////////////////////////////////////////////////////////////////// + /// \brief Comparison with a single element. + //////////////////////////////////////////////////////////////////////////// + inline bool operator== (const value_type &o) const + { + static_assert(cardinality == 1); + return this->_values[0] == o; + } + //////////////////////////////////////////////////////////////////////////// /// \brief Point-wise Equality. //////////////////////////////////////////////////////////////////////////// @@ -381,6 +390,15 @@ namespace adiar::internal inline bool operator!= (const tuple &o) const { return !(*this == o); } + //////////////////////////////////////////////////////////////////////////// + /// \brief Comparison with a single element. + //////////////////////////////////////////////////////////////////////////// + inline bool operator!= (const value_type &o) const + { + static_assert(cardinality == 1); + return this->_values[0] != o; + } + //////////////////////////////////////////////////////////////////////////// /// \brief Lexicographical Less-Than and Equality. ////////////////////////////////////////////////////////////////////////////