Let assume I have a function like
template<typename charT>
void fun(std::basic_ostream<charT>& out, std::basic_fstream<charT>& file)
{
std::basic_string<charT> str;
file>>str;
out<<str;
}
Note: file is encoded as utf-8
I am not knowledgeable with Unicode. Can I use this function for both ASCII and Unicode, or build a class using basic_type so that class class can be use for both Unicode and ASCII.
My question is there is any difference between ASCII and Unicode at processing level?
Edit:
processing level means doing operation on that strings like append, print and take string from file.
Why i am asking that question is std::string and std::wstring are typedef ed version of basic_string having char and wchar_t
and std::cout and std::wcout are typedef ed version of std::basic_ostream having char and wchar_t but both code are same.
in both cases difference is only memory.
so i build a class using basic_type so that class can be used for both ASCII and Unicode.