clover/functional: add id_equals helper
authorKarol Herbst <kherbst@redhat.com>
Tue, 30 Jul 2019 11:36:37 +0000 (13:36 +0200)
committerKarol Herbst <karolherbst@gmail.com>
Sat, 21 Sep 2019 08:28:32 +0000 (08:28 +0000)
v2: pass argument by value

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
src/gallium/state_trackers/clover/util/functional.hpp

index 98bbdff4bd1044e3fc5be064b84ae97ab887bfab..fc281c5c79a6a139dd1fdf22c02d43755d3d7979 100644 (file)
@@ -347,6 +347,21 @@ namespace clover {
       const std::string &name;
    };
 
+   class id_equals {
+   public:
+      id_equals(const uint32_t id) : id(id) {
+      }
+
+      template<typename T>
+      bool
+      operator()(const T &x) const {
+         return x.id == id;
+      }
+
+   private:
+      const uint32_t id;
+   };
+
    template<typename T>
    class key_equals_t {
    public: