C++ std::basic_string/char_traits 特化 [英] C++ std::basic_string/char_traits specialization
问题描述
这与:
我尝试了 std::basic_string specialization 中的解决方案,但问题是 CustomChar 是wchar_t 的 typedef 和我重新定义(与 std 的专业化冲突).当我不允许更改 CustomChar typedef 时,如何避免使用 chart_traits?
I tried the solution from std::basic_string specialization, but the problem is that CustomChar is a typedef for wchar_t and I have redefinition(conflict with specialization from std). How may I avoid usage of chart_traits when I'm not allowed to change CustomChar typedef?
推荐答案
这是 Charles Bailey 作为评论提供的答案:
This is the answer provided by Charles Bailey as a comment:
您可以提供一个替代的traits 类(即std::char_traits 特化以外的东西),同时仍然使用wchar_t 作为std::basic_string 的charT 模板参数
You can supply an alternative traits class (i.e. something other than a std::char_traits specialization) while still using wchar_t as the charT template parameter to std::basic_string
这篇关于C++ std::basic_string/char_traits 特化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!