Suppose I have a function that manages strings and handles all char types perfectly.
template<typename CharT> std::basic_string<CharT> foo_basic_string() { return std::basic_string<CharT, char_traits<CharT>, allocator<CharT> >(); }
I want the functions foo_string and foo_wstring be a version of foo_basic_string and return std::string and std::wstring respectively.
One of the methods -
std::string foo_string() { return foo_basic_string<char>(); } std::wstring foo_wstring() { return foo_basic_string<wchar_t>(); }
I was wondering if there is a way to declare foo_string as being actually an instance of foo_basic_string<char> .
source share