diff options
author | MacDue <macdue@dueutil.tech> | 2023-05-29 19:02:00 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-06-01 06:25:00 +0200 |
commit | 81ff242e8657b0647ece83c88b4b3a1454eb5a84 (patch) | |
tree | e33d737a8f76881f2e3ad89f48b474d6331afbb4 /AK/GenericShorthands.h | |
parent | 5339b54b5dbe9a26d4e20fb75f5ed20a7fcef495 (diff) | |
download | serenity-81ff242e8657b0647ece83c88b4b3a1454eb5a84.zip |
AK: Mark generic shorthand functions as constexpr
Diffstat (limited to 'AK/GenericShorthands.h')
-rw-r--r-- | AK/GenericShorthands.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/AK/GenericShorthands.h b/AK/GenericShorthands.h index 73941857df..c2fd328a3d 100644 --- a/AK/GenericShorthands.h +++ b/AK/GenericShorthands.h @@ -11,55 +11,55 @@ namespace AK { template<typename T, typename... Ts> -[[nodiscard]] bool first_is_one_of(T const to_compare, Ts const... valid_values) +[[nodiscard]] constexpr bool first_is_one_of(T const to_compare, Ts const... valid_values) { return (... || (to_compare == valid_values)); } template<typename T, typename... Ts> -[[nodiscard]] bool first_is_smaller_than_one_of(T const to_compare, Ts const... valid_values) +[[nodiscard]] constexpr bool first_is_smaller_than_one_of(T const to_compare, Ts const... valid_values) { return (... || (to_compare < valid_values)); } template<typename T, typename... Ts> -[[nodiscard]] bool first_is_smaller_or_equal_than_one_of(T const to_compare, Ts const... valid_values) +[[nodiscard]] constexpr bool first_is_smaller_or_equal_than_one_of(T const to_compare, Ts const... valid_values) { return (... || (to_compare <= valid_values)); } template<typename T, typename... Ts> -[[nodiscard]] bool first_is_larger_than_one_of(T const to_compare, Ts const... valid_values) +[[nodiscard]] constexpr bool first_is_larger_than_one_of(T const to_compare, Ts const... valid_values) { return (... || (to_compare > valid_values)); } template<typename T, typename... Ts> -[[nodiscard]] bool first_is_larger_or_equal_than_one_of(T const to_compare, Ts const... valid_values) +[[nodiscard]] constexpr bool first_is_larger_or_equal_than_one_of(T const to_compare, Ts const... valid_values) { return (... || (to_compare >= valid_values)); } template<typename T, typename... Ts> -[[nodiscard]] bool first_is_smaller_than_all_of(T const to_compare, Ts const... valid_values) +[[nodiscard]] constexpr bool first_is_smaller_than_all_of(T const to_compare, Ts const... valid_values) { return (... && (to_compare < valid_values)); } template<typename T, typename... Ts> -[[nodiscard]] bool first_is_smaller_or_equal_than_all_of(T const to_compare, Ts const... valid_values) +[[nodiscard]] constexpr bool first_is_smaller_or_equal_than_all_of(T const to_compare, Ts const... valid_values) { return (... && (to_compare <= valid_values)); } template<typename T, typename... Ts> -[[nodiscard]] bool first_is_larger_than_all_of(T const to_compare, Ts const... valid_values) +[[nodiscard]] constexpr bool first_is_larger_than_all_of(T const to_compare, Ts const... valid_values) { return (... && (to_compare > valid_values)); } template<typename T, typename... Ts> -[[nodiscard]] bool first_is_larger_or_equal_than_all_of(T const to_compare, Ts const... valid_values) +[[nodiscard]] constexpr bool first_is_larger_or_equal_than_all_of(T const to_compare, Ts const... valid_values) { return (... && (to_compare >= valid_values)); } |