mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +00:00
AK: Mark generic shorthand functions as constexpr
This commit is contained in:
parent
5339b54b5d
commit
81ff242e86
Notes:
sideshowbarker
2024-07-17 22:01:16 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/81ff242e86 Pull-request: https://github.com/SerenityOS/serenity/pull/19191
1 changed files with 9 additions and 9 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue