From 46810235e3a8420b3379b352dd6b19d7a0439acd Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Tue, 27 Jul 2021 06:35:54 +0300 Subject: =?UTF-8?q?Refactor:=20Avoid=20`if`=20=E2=86=92=20`else=20if`=20?= =?UTF-8?q?=E2=86=92=20=E2=80=A6=20for=20compare=20operators?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When trying to match one of compare operator key inside `if()` condition, remember the index of matched operator. Later this index used to select the operation to perform instead of strings compare again. --- Source/cmConditionEvaluator.cxx | 157 ++++++++++++++++++++++++---------------- Source/cmConditionEvaluator.h | 9 +++ 2 files changed, 104 insertions(+), 62 deletions(-) diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index cec9691..570bb4a 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -57,6 +57,34 @@ auto const keyVERSION_GREATER_EQUAL = "VERSION_GREATER_EQUAL"_s; auto const keyVERSION_LESS = "VERSION_LESS"_s; auto const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL"_s; +// Run-Time to Compile-Time template selector +template