diff --git a/include/cserver/engine/components.hpp b/include/cserver/engine/components.hpp index 3592ac7..ae6ff39 100644 --- a/include/cserver/engine/components.hpp +++ b/include/cserver/engine/components.hpp @@ -334,9 +334,26 @@ namespace impl { template struct DependencyInfoKey {}; +template +consteval auto IsConstantImpl(...) { + return false; +}; + +template +consteval auto IsConstantImpl(bool) { + return true; +}; + +template +consteval auto IsConstant() -> bool { + return IsConstantImpl(true); // NOLINT +}; + template inline constexpr auto Use() { - std::ignore = __builtin_constant_p(T{Args...}); + std::ignore = IsConstant<[] { + T{Args...}; + }>(); }; template