9 Mar
2010
9 Mar
'10
5:44 p.m.
AMDG Alex Lamaison wrote:
I'd like to use basic_path as a function parameter so that it works correctly whether a wide or narrow string is passed.
template<typename T> void func(basic_path<T> file) { do thing to file }
func("myfile"); func(L"myfile");
There's no way to get the compiler to deduce T, since the argument types are "const char[...]" and "const wchar_t[...]". If you want this, you'll have to either overload for pointers or do something like template<typename T> void func_impl(basic_path<T> file); void func(path file) { func_impl(file); } void func(wpath file) { func_impl(file); } In Christ, Steven Watanabe