Boost logo

Boost Users :

Subject: Re: [Boost-users] [filesystem] basic_path as parameter
From: Alexander Lamaison (awl03_at_[hidden])
Date: 2010-03-10 07:07:07


On Tue, 09 Mar 2010 09:44:46 -0800, Steven Watanabe wrote:
> Alex Lamaison wrote:
>>
>> 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); }

Thanks Steven. This is what I'll do.

Looking forward to filesystem v3 which should fix this!

Alex


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net