diff --git a/enum.h b/enum.h index d423eef..edd92a0 100644 --- a/enum.h +++ b/enum.h @@ -1150,6 +1150,23 @@ struct map_compare { } }; +// chenyao add +template <> +struct map_compare { + BETTER_ENUMS_CONSTEXPR_ static bool less(const wchar_t *a, const wchar_t *b) + { return less_loop(a, b); } + + private: + BETTER_ENUMS_CONSTEXPR_ static bool + less_loop(const wchar_t *a, const wchar_t *b, size_t index = 0) + { + return + a[index] != b[index] ? a[index] < b[index] : + a[index] == L'\0' ? false : + less_loop(a, b, index + 1); + } +}; + template > struct map { typedef T (*function)(Enum);