@@ -196,9 +196,9 @@ template <typename T, typename UC>
196
196
FASTFLOAT_CONSTEXPR20 from_chars_result_t <UC>
197
197
from_chars_advanced (parsed_number_string_t <UC> &pns, T &value) noexcept {
198
198
199
- static_assert (is_supported_float_type<T>() ,
199
+ static_assert (is_supported_float_type<T>::value ,
200
200
" only some floating-point types are supported" );
201
- static_assert (is_supported_char_type<UC>() ,
201
+ static_assert (is_supported_char_type<UC>::value ,
202
202
" only char, wchar_t, char16_t and char32_t are supported" );
203
203
204
204
from_chars_result_t <UC> answer;
@@ -285,9 +285,9 @@ FASTFLOAT_CONSTEXPR20 from_chars_result_t<UC>
285
285
from_chars_float_advanced (UC const *first, UC const *last, T &value,
286
286
parse_options_t <UC> options) noexcept {
287
287
288
- static_assert (is_supported_float_type<T>() ,
288
+ static_assert (is_supported_float_type<T>::value ,
289
289
" only some floating-point types are supported" );
290
- static_assert (is_supported_char_type<UC>() ,
290
+ static_assert (is_supported_char_type<UC>::value ,
291
291
" only char, wchar_t, char16_t and char32_t are supported" );
292
292
293
293
chars_format const fmt = detail::adjust_for_feature_macros (options.format );
@@ -323,8 +323,9 @@ template <typename T, typename UC, typename>
323
323
FASTFLOAT_CONSTEXPR20 from_chars_result_t <UC>
324
324
from_chars (UC const *first, UC const *last, T &value, int base) noexcept {
325
325
326
- static_assert (std::is_integral<T>::value, " only integer types are supported" );
327
- static_assert (is_supported_char_type<UC>(),
326
+ static_assert (is_supported_integer_type<T>::value,
327
+ " only integer types are supported" );
328
+ static_assert (is_supported_char_type<UC>::value,
328
329
" only char, wchar_t, char16_t and char32_t are supported" );
329
330
330
331
parse_options_t <UC> options;
@@ -337,8 +338,9 @@ FASTFLOAT_CONSTEXPR20 from_chars_result_t<UC>
337
338
from_chars_int_advanced (UC const *first, UC const *last, T &value,
338
339
parse_options_t <UC> options) noexcept {
339
340
340
- static_assert (std::is_integral<T>::value, " only integer types are supported" );
341
- static_assert (is_supported_char_type<UC>(),
341
+ static_assert (is_supported_integer_type<T>::value,
342
+ " only integer types are supported" );
343
+ static_assert (is_supported_char_type<UC>::value,
342
344
" only char, wchar_t, char16_t and char32_t are supported" );
343
345
344
346
chars_format const fmt = detail::adjust_for_feature_macros (options.format );
@@ -359,7 +361,11 @@ from_chars_int_advanced(UC const *first, UC const *last, T &value,
359
361
return parse_int_string (first, last, value, options);
360
362
}
361
363
362
- template <bool > struct from_chars_advanced_caller {
364
+ template <size_t TypeIx> struct from_chars_advanced_caller {
365
+ static_assert (TypeIx > 0 , " unsupported type" );
366
+ };
367
+
368
+ template <> struct from_chars_advanced_caller <1 > {
363
369
template <typename T, typename UC>
364
370
FASTFLOAT_CONSTEXPR20 static from_chars_result_t <UC>
365
371
call (UC const *first, UC const *last, T &value,
@@ -368,7 +374,7 @@ template <bool> struct from_chars_advanced_caller {
368
374
}
369
375
};
370
376
371
- template <> struct from_chars_advanced_caller <false > {
377
+ template <> struct from_chars_advanced_caller <2 > {
372
378
template <typename T, typename UC>
373
379
FASTFLOAT_CONSTEXPR20 static from_chars_result_t <UC>
374
380
call (UC const *first, UC const *last, T &value,
@@ -381,8 +387,10 @@ template <typename T, typename UC>
381
387
FASTFLOAT_CONSTEXPR20 from_chars_result_t <UC>
382
388
from_chars_advanced (UC const *first, UC const *last, T &value,
383
389
parse_options_t <UC> options) noexcept {
384
- return from_chars_advanced_caller<is_supported_float_type<T>()>::call (
385
- first, last, value, options);
390
+ return from_chars_advanced_caller<
391
+ size_t (is_supported_float_type<T>::value) +
392
+ 2 * size_t (is_supported_integer_type<T>::value)>::call (first, last, value,
393
+ options);
386
394
}
387
395
388
396
} // namespace fast_float
0 commit comments