#ifndef SV_CHAR_TRAITS_H #define SV_CHAR_TRAITS_H #include #include /* * Inherit from std::char_traits and redefine lt() and compare(). */ struct sv_char_traits : public std::char_traits { static bool lt(const char_type& c1, const char_type& c2) { if (std::strchr("ΔΕδε", c1) && std::strchr("ΔΕδε", c2)) { return std::strchr("ΕΔεδ", c1) < std::strchr("ΕΔεδ", c2); } return static_cast(c1) < static_cast(c2); } static int compare(const char_type* s1, const char_type* s2, size_t n) { for (size_t i = 0; i < n; ++i) if (!eq(s1[i], s2[i])) return lt(s1[i], s2[i]) ? -1 : 1; return 0; } }; #endif