std::char_traits<> are kind of suboptimal for UTF8 (or any kind of multibyte strings) especially if you want to implement case insensitive behaviour. I'm currently thinking about creating a text_traits<> template, like:
template<typename CharT> struct text_traits : public std::char_traits<CharT>
{
static bool eq(const CharT *p1,const CharT *p2)
{
return std::char_traits<CharT>::eq(*p1,*p2);
}
}
and similiar functions for lt or find. Now my question before I dive into this: Is this totally silly? Is it conforming to the Standard? Background: I need something like a std::basic_string_view with more advanced search Options, e.g. "ignore case" - that's why I ran into this)
Aucun commentaire:
Enregistrer un commentaire