C++ std::basic_string/char_traits specialization

倾然丶 夕夏残阳落幕 提交于 2019-12-14 03:12:59

问题


This is related to:

std::basic_string specialization and Circumventing template specialization

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?


回答1:


You could use Boost's/C++0x's disable_if to disable if there are known previous instantiations, like in the case of char and wchar_t.




回答2:


This is the answer provided by Charles Bailey as a comment:

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



来源:https://stackoverflow.com/questions/6548319/c-stdbasic-string-char-traits-specialization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!