Fix narrowing conversion warning in struct fstring (#4210)

Warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data.
This commit is contained in:
Sergey 2024-10-27 06:41:20 -07:00 committed by GitHub
parent 168df9a064
commit 68f3153762
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2658,12 +2658,14 @@ inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; }
/// A compile-time format string.
template <typename... T> struct fstring {
private:
static constexpr int num_static_named_args =
static constexpr size_t num_static_named_args =
detail::count_static_named_args<T...>();
using checker = detail::format_string_checker<
char, static_cast<int>(sizeof...(T)), num_static_named_args,
num_static_named_args != detail::count_named_args<T...>()>;
using checker =
detail::format_string_checker<char, static_cast<int>(sizeof...(T)),
static_cast<int>(num_static_named_args),
num_static_named_args !=
detail::count_named_args<T...>()>;
using arg_pack = detail::arg_pack<T...>;