Added inline and constexpr when possible

This commit is contained in:
saundersp
2024-06-09 22:41:37 +02:00
parent ac6755517b
commit 8058fac200
4 changed files with 108 additions and 107 deletions

View File

@ -16,13 +16,13 @@ namespace asp {
std::string format_byte_size(uint64_t) noexcept;
std::string format_time(const uint64_t) noexcept;
std::string format_time_ns(uint64_t) noexcept;
void toolbox_unit_test() noexcept;
void toolbox_unit_test(void) noexcept;
std::string thousand_sep(const uint64_t&, const char&) noexcept;
std::string thousand_sep(const uint64_t&) noexcept;
void print_separator(const char*) noexcept;
void print_separator(const char* const) noexcept;
template <typename F, typename... Args>
void measure_time_void(const char* step_name, const F& fnc, Args &&...args) noexcept {
inline constexpr void measure_time_void(const char* step_name, const F& fnc, Args &&...args) noexcept {
#ifndef __DEBUG
printf("| %-" STR(W_NAME) "s | %" STR(W_TIME) "s | %-" STR(W_FTIME) "s |\r", step_name, "In progress", "In progress");
#endif
@ -33,7 +33,7 @@ namespace asp {
}
template <typename T, typename F, typename... Args>
T measure_time(const char* step_name, const F& fnc, Args &&...args) noexcept {
inline constexpr T measure_time(const char* step_name, const F& fnc, Args &&...args) noexcept {
#ifndef __DEBUG
printf("| %-" STR(W_NAME) "s | %" STR(W_TIME) "s | %-" STR(W_FTIME) "s |\r", step_name, "In progress", "In progress");
#endif