From 28707686cf39aea27c4ec63911ee52f33e13efbd Mon Sep 17 00:00:00 2001 From: Andersama Date: Wed, 6 Jan 2021 22:12:03 -0800 Subject: [PATCH] patch: handles all forms of repeats --- include/ctre/starts_with_anchor.hpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/include/ctre/starts_with_anchor.hpp b/include/ctre/starts_with_anchor.hpp index 62c28b97..807bbcc8 100644 --- a/include/ctre/starts_with_anchor.hpp +++ b/include/ctre/starts_with_anchor.hpp @@ -34,18 +34,6 @@ constexpr bool starts_with_anchor(const flags & f, ctll::list return (starts_with_anchor(f, ctll::list{}) && ... && true); } -template -constexpr bool starts_with_anchor(const flags & f, ctll::list, Content...>) noexcept { - // check if all options starts with anchor or if they are empty, there is an anchor behind them - return starts_with_anchor(f, ctll::list{}) && starts_with_anchor(f, ctll::list{}); -} - -template -constexpr bool starts_with_anchor(const flags & f, ctll::list, Content...>) noexcept { - // check if all options starts with anchor or if they are empty, there is an anchor behind them - return starts_with_anchor(f, ctll::list{}) && starts_with_anchor(f, ctll::list{}); -} - template constexpr bool starts_with_anchor(const flags & f, ctll::list, Content...>) noexcept { // check if all options starts with anchor or if they are empty, there is an anchor behind them @@ -55,19 +43,28 @@ constexpr bool starts_with_anchor(const flags & f, ctll::list, template constexpr bool starts_with_anchor(const flags & f, ctll::list, Content...>) noexcept { // check if all options starts with anchor or if they are empty, there is an anchor behind them - return starts_with_anchor(f, ctll::list{}); + if constexpr (A > 0) + return starts_with_anchor(f, ctll::list{}); + else + return starts_with_anchor(f, ctll::list{}) && starts_with_anchor(f, ctll::list{}); } template constexpr bool starts_with_anchor(const flags & f, ctll::list, Content...>) noexcept { // check if all options starts with anchor or if they are empty, there is an anchor behind them - return starts_with_anchor(f, ctll::list{}); + if constexpr (A > 0) + return starts_with_anchor(f, ctll::list{}); + else + return starts_with_anchor(f, ctll::list{}) && starts_with_anchor(f, ctll::list{}); } template constexpr bool starts_with_anchor(const flags & f, ctll::list, Content...>) noexcept { // check if all options starts with anchor or if they are empty, there is an anchor behind them - return starts_with_anchor(f, ctll::list{}); + if constexpr (A > 0) + return starts_with_anchor(f, ctll::list{}); + else + return starts_with_anchor(f, ctll::list{}) && starts_with_anchor(f, ctll::list{}); } template