Changed the way recursion ends in const_fmt::format_args<>()

This commit is contained in:
Andreas Tsouchlos 2022-03-18 01:23:56 +01:00
parent 036b17fca9
commit 2be63fda5a
2 changed files with 6 additions and 6 deletions

View File

@ -66,16 +66,13 @@ constexpr inline void format_arg(char* dest, const char* arg) {
};
// End of recursion
template <auto ast>
constexpr inline void format_args(char*) {
}
template <auto fmt_data_array, typename first_arg_t, typename... args_t>
constexpr inline void format_args(char* dest, first_arg_t first_arg,
args_t... args) {
format_arg<fmt_data_array[0]>(dest + fmt_data_array[0].position, first_arg);
format_args<drop_first(fmt_data_array)>(dest, args...);
if constexpr(fmt_data_array.size() > 1)
format_args<drop_first(fmt_data_array)>(dest, args...);
}

View File

@ -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];