Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes 'std::ptrdiff_t' to 'std::size_t' casting error and suppresses …
…`-Wuseless-cast` warning for gcc and clang (Neargye#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')} {} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
- Loading branch information