From 3bd0ef4e43ca49b40e6c39685c417617bff681d9 Mon Sep 17 00:00:00 2001 From: Leonid Fedorov Date: Thu, 8 Jun 2023 22:54:16 +0000 Subject: [PATCH] Replace std::set contains method with count to support Rocky/RHEL/Alma 8 where the std::set in the stock STL does not have contains method --- CMakeLists.txt | 13 ------------- dbcon/execplan/rewrites.cpp | 4 ++-- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa2b7f0cc..59fb0450f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,19 +62,6 @@ ELSE() ENDIF() ENDIF() -CHECK_CXX_SOURCE_COMPILES( -"#include -int main() -{ - std::set s = {1, 2, 3, 4}; - return s.contains(2); -}" HAVE_STD_SET_CONTAINS) - -IF (NOT HAVE_STD_SET_CONTAINS) - MESSAGE_ONCE(CS_NO_CONTAINS "std::set does not have contains() method") - RETURN() -ENDIF() - # There is an inconsistency b/w default char signedness at ARM and x86. # This flag explicitly sets char as signed. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char") diff --git a/dbcon/execplan/rewrites.cpp b/dbcon/execplan/rewrites.cpp index e7e7f00f4..69f91471c 100644 --- a/dbcon/execplan/rewrites.cpp +++ b/dbcon/execplan/rewrites.cpp @@ -59,12 +59,12 @@ SimpleFilter* castToSimpleFilter(execplan::TreeNode* node) bool commonContainsSemantic(const CommonContainer& common, execplan::ParseTree* node) { auto filter = castToFilter(node); - return filter && common.first.contains(node); + return filter && common.first.count(node) != 0; } bool commonContainsPtr(const CommonContainer& common, execplan::ParseTree* node) { - return common.second.contains(node); + return common.second.count(node) != 0; } OpType operatorType(execplan::ParseTree* node)