Q:

There is any difference between ascii and unicode at processing level?

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.

A:

There is any difference between ascii and unicode

Yes. They are distinct encodings and not identical. As such, there are differences.

Can I use this function for both ASCII and Unicode

Yes. For UTF-8 (assuming size of byte is 8 bits).
The function does nothing that would require different handling between those encodings.
Although, if you want to read the output from a terminal, it depends on the capabilities and cofiguration of the terminal which encoding it uses to show the output. If it doesn't match what you're printing, then the output may be misinterpreted.

