You can do this
wstring _wstring_a(L"aaa"); wstring _wstring_b = L"bbb";
because those are runtime conversion operations. When you compile this, the compiler understands what you are trying to do and inserts the appropriate conversions to 'make' a wstring. The difference is that L"bbb" is not
a wstring, but the compiler knows how it can make a wstring at runtime.
What you are trying to do is at compile time providing a type that the compiler wants to use to determine chartype. But because it is not
a basic_string, it doesn't know how to do it.
If you do this:
foo(wstring(L"text goes here"))
Then the compiler knows which template argument to use because you're explicitly telling it.
The solution is either to do this, or help the compiler find its way to the correct solution
The best I can come up with atm is this
template<typename chartype >
void foo(basic_string<chartype> _basic_string)
void foo(T* ptrstr)
Which basically takes a pointer that is pointing to a type that can be used as a basic_string character type. It will then remove the 'const' from the type because the standard doesn't allow it, and use that datatype as template argument for basic_string