/* * Copyright (c) 2022, Frhun * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace AK { template [[nodiscard]] constexpr bool first_is_one_of(T&& to_compare, Ts&&... valid_values) { return (... || (forward(to_compare) == forward(valid_values))); } template [[nodiscard]] constexpr bool first_is_smaller_than_one_of(T&& to_compare, Ts&&... valid_values) { return (... || (forward(to_compare) < forward(valid_values))); } template [[nodiscard]] constexpr bool first_is_smaller_or_equal_than_one_of(T&& to_compare, Ts&&... valid_values) { return (... || (forward(to_compare) <= forward(valid_values))); } template [[nodiscard]] constexpr bool first_is_larger_than_one_of(T&& to_compare, Ts&&... valid_values) { return (... || (forward(to_compare) > forward(valid_values))); } template [[nodiscard]] constexpr bool first_is_larger_or_equal_than_one_of(T&& to_compare, Ts&&... valid_values) { return (... || (forward(to_compare) >= forward(valid_values))); } template [[nodiscard]] constexpr bool first_is_equal_to_all_of(T&& to_compare, Ts&&... valid_values) { return (... && (forward(to_compare) == forward(valid_values))); } template [[nodiscard]] constexpr bool first_is_smaller_than_all_of(T&& to_compare, Ts&&... valid_values) { return (... && (forward(to_compare) < forward(valid_values))); } template [[nodiscard]] constexpr bool first_is_smaller_or_equal_than_all_of(T&& to_compare, Ts&&... valid_values) { return (... && (forward(to_compare) <= forward(valid_values))); } template [[nodiscard]] constexpr bool first_is_larger_than_all_of(T&& to_compare, Ts&&... valid_values) { return (... && (forward(to_compare) > forward(valid_values))); } template [[nodiscard]] constexpr bool first_is_larger_or_equal_than_all_of(T&& to_compare, Ts&&... valid_values) { return (... && (forward(to_compare) >= forward(valid_values))); } } #if USING_AK_GLOBALLY using AK::first_is_equal_to_all_of; using AK::first_is_larger_or_equal_than_all_of; using AK::first_is_larger_or_equal_than_one_of; using AK::first_is_larger_than_all_of; using AK::first_is_larger_than_one_of; using AK::first_is_one_of; using AK::first_is_smaller_or_equal_than_all_of; using AK::first_is_smaller_or_equal_than_one_of; using AK::first_is_smaller_than_all_of; using AK::first_is_smaller_than_one_of; #endif