diff options
4 files changed, 10 insertions, 9 deletions
diff --git a/libs/kstd/include/kstd/bits/format/args.hpp b/libs/kstd/include/kstd/bits/format/args.hpp index 008cc03..d1586ac 100644 --- a/libs/kstd/include/kstd/bits/format/args.hpp +++ b/libs/kstd/include/kstd/bits/format/args.hpp @@ -36,7 +36,7 @@ namespace kstd template<typename ValueType> constexpr auto determine_arg_type() -> arg_type { - using decay_type = std::remove_cvref_t<std::decay_t<ValueType>>; + using decay_type = std::remove_cvref_t<ValueType>; if constexpr (std::same_as<decay_type, bool>) { return arg_type::boolean; @@ -57,7 +57,8 @@ namespace kstd { return arg_type::string_view; } - else if constexpr (std::same_as<decay_type, char *> || std::same_as<decay_type, char const *>) + else if constexpr (std::same_as<std::decay_t<decay_type>, char *> || + std::same_as<std::decay_t<decay_type>, char const *>) { return arg_type::c_string; } diff --git a/libs/kstd/include/kstd/bits/format/formatter.hpp b/libs/kstd/include/kstd/bits/format/formatter.hpp index bff5f55..f391c8e 100644 --- a/libs/kstd/include/kstd/bits/format/formatter.hpp +++ b/libs/kstd/include/kstd/bits/format/formatter.hpp @@ -7,7 +7,12 @@ namespace kstd { template<typename> - struct formatter; + struct formatter + { + formatter() = delete; + formatter(formatter const &) = delete; + auto operator=(formatter const &) -> formatter & = delete; + }; } // namespace kstd diff --git a/libs/kstd/include/kstd/bits/format/formatter/cstring.hpp b/libs/kstd/include/kstd/bits/format/formatter/cstring.hpp index bf52f2e..9afb974 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/cstring.hpp +++ b/libs/kstd/include/kstd/bits/format/formatter/cstring.hpp @@ -5,7 +5,6 @@ #include "../formatter.hpp" #include "string_view.hpp" -#include <cstddef> #include <string_view> namespace kstd @@ -25,11 +24,6 @@ namespace kstd { }; - template<std::size_t N> - struct formatter<char[N]> : formatter<std::string_view> // NOLINT - { - }; - } // namespace kstd #endif
\ No newline at end of file diff --git a/libs/kstd/include/kstd/bits/format/string.hpp b/libs/kstd/include/kstd/bits/format/string.hpp index edeaed1..40282e4 100644 --- a/libs/kstd/include/kstd/bits/format/string.hpp +++ b/libs/kstd/include/kstd/bits/format/string.hpp @@ -28,6 +28,7 @@ namespace kstd if (current_index == target_index && !found) { using decay_type = std::remove_cvref_t<Args>; + static_assert(std::is_default_constructible_v<formatter<decay_type>>, "Missing formatter specialization."); auto fmt = formatter<decay_type>{}; auto it = fmt.parse(context); |
