1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00
magic_enum/include
Ralph J. Steinhagen 5cf4eb3a53
fixes 'std::ptrdiff_t' to 'std::size_t' casting error and suppresses -Wuseless-cast warning for gcc and clang (#306)
* fixes 'std::ptrdiff_t' to 'std::size_t' casting error

addresses this compiler warning:

```text
[..]/magic_enum_utility.hpp:101:31: warning: conversion to ‘std::size_t’ {aka ‘long unsigned int’} from ‘std::ptrdiff_t’ {aka ‘long int’} may change the sign of the result [-Wsign-conversion]
  101 |       return enum_value<D, S>(index);
      |                               ^~~~~
```

* suppresses `-Wuseless-cast` for static_cast<char_type>('\0')

needed in case 'char_type' is 'char' (common on Linux but rare on Windows?)

```text
[..]/magic_enum.hpp:275:114: warning: useless cast to type ‘using magic_enum::char_type = using std::basic_string_view<char>::value_type = char’ {aka ‘char’} [-Wuseless-cast]
  275 |   constexpr static_str(string_view str, std::integer_sequence<std::uint16_t, I...>) noexcept : chars_{str[I]..., static_cast<char_type>('\0')} {}
      |                                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2023-11-09 14:07:16 +04:00
..
magic_enum.hpp fixes 'std::ptrdiff_t' to 'std::size_t' casting error and suppresses -Wuseless-cast warning for gcc and clang (#306) 2023-11-09 14:07:16 +04:00
magic_enum_all.hpp v0.9.3 2023-06-22 17:22:05 +04:00
magic_enum_containers.hpp v0.9.3 2023-06-22 17:22:05 +04:00
magic_enum_flags.hpp v0.9.3 2023-06-22 17:22:05 +04:00
magic_enum_format.hpp fix fmt::formatter 2023-09-20 18:44:31 +04:00
magic_enum_fuse.hpp v0.9.3 2023-06-22 17:22:05 +04:00
magic_enum_iostream.hpp v0.9.3 2023-06-22 17:22:05 +04:00
magic_enum_switch.hpp fix Argument-dependent lookup results in enum_switch 2023-10-04 19:14:27 +04:00
magic_enum_utility.hpp fixes 'std::ptrdiff_t' to 'std::size_t' casting error and suppresses -Wuseless-cast warning for gcc and clang (#306) 2023-11-09 14:07:16 +04:00