diff --git a/const_fmt/format.h b/const_fmt/format.h index ee42bb5..1f05748 100644 --- a/const_fmt/format.h +++ b/const_fmt/format.h @@ -66,16 +66,13 @@ constexpr inline void format_arg(char* dest, const char* arg) { }; -// End of recursion -template -constexpr inline void format_args(char*) { -} - template constexpr inline void format_args(char* dest, first_arg_t first_arg, args_t... args) { format_arg(dest + fmt_data_array[0].position, first_arg); - format_args(dest, args...); + + if constexpr(fmt_data_array.size() > 1) + format_args(dest, args...); } diff --git a/const_fmt/stdlib.h b/const_fmt/stdlib.h index e77a3c5..8984489 100644 --- a/const_fmt/stdlib.h +++ b/const_fmt/stdlib.h @@ -251,6 +251,9 @@ public: } } + constexpr std::size_t size() const noexcept { + return t_size; + } constexpr data_t& operator[](std::size_t index) noexcept { return m_data[index];