#pragma once #ifndef __FILE_Detail_CP_CWhile_Hpp #define __FILE_Detail_CP_CWhile_Hpp struct CRange { template class Callable, size_t End> constexpr static void Range() { Range(); } template class Callable, int Start, int Stop, int Step = 1> constexpr static void Range() { if constexpr (Step == 0) static_assert(Step == 0, "Step not support 0"); Callable call; call(); if constexpr (Start < Stop && Start + Step > Stop) static_assert(Start < Stop && Start + Step > Stop, "While not stop"); if constexpr (Start > Stop && Start + Step < Stop) static_assert(Start > Stop && Start + Step < Stop, "While not stop"); if constexpr (Start + Step != Stop) Range(); } }; template struct CWhile { template class Callable, template class Pr, size_t MaxDepth, typename... Args> constexpr static void WhileWithArgs(Args... args) { Callable call; call(args...); Pr pr; if constexpr (pr(args...)) { if constexpr (MaxDepth != 0) { WhileWithArgs(args...); } else { static_assert(MaxDepth == 0, "WhileWithArgs is touch MaxDepth"); } } } template class Pr, size_t MaxDepth, typename... Args> constexpr static void WhileWithArgs(Args... args) { Callable call; call(); Pr pr; if constexpr (pr(args...)) { if constexpr (MaxDepth != 0) { WhileWithArgs(args...); } else { static_assert(MaxDepth == 0, "WhileWithArgs is touch MaxDepth"); } } } template class Callable, typename Pr, size_t MaxDepth, typename... Args> constexpr static void WhileWithArgs(Args... args) { Callable call; call(args...); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { WhileWithArgs(args...); } else { static_assert(MaxDepth == 0, "WhileWithArgs is touch MaxDepth"); } } } template class Callable, template class Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, template class Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, template class Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, template class Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, template class Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, typename Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, template class Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, template class Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, typename Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, template class Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } template class Callable, typename Pr, size_t MaxDepth, int Start, int Stop, int Step> constexpr static void WhileWithTemplate() { Callable call; call(); Pr pr; if constexpr (pr()) { if constexpr (MaxDepth != 0) { if constexpr (Start + Step != Stop) WhileWithTemplate(); } else { static_assert(MaxDepth == 0, "WhileWithTemplate is touch MaxDepth"); } } } }; #endif // !__FILE_Detail_CP_CWhile_Hpp