feat: add termcolor in carton.

- add termcolor and its testbench
- add integer() in flag_enum and update its testbench according to the requirements in termcolor.
This commit is contained in:
2025-08-19 13:50:51 +08:00
parent dfc0c127c5
commit 8a72e6a655
8 changed files with 466 additions and 71 deletions

View File

@ -191,4 +191,17 @@ namespace yycc::flag_enum {
return static_cast<bool>(static_cast<ut>(e));
}
/**
* @brief Cast given enum flags to its equvalent underlying integer value like performing <TT>static_cast<std::underlying_type_t<T>>(e)</TT>
* @tparam TEnum Enum type for processing.
* @param e The enum flags to be cast.
* @return The equvalent integer value of given enum flag.
*/
template<typename TEnum>
requires(std::is_enum_v<TEnum>)
constexpr std::underlying_type_t<TEnum> integer(TEnum e) {
using ut = std::underlying_type_t<TEnum>;
return static_cast<ut>(e);
}
} // namespace yycc::flag_enum