Boost logo

Boost :

Subject: Re: [boost] [1.44] [filesystem] filesystem::path construction problems in version 3
From: Beman Dawes (bdawes_at_[hidden])
Date: 2010-08-24 14:41:58


On Thu, Aug 19, 2010 at 1:33 PM, Beman Dawes <bdawes_at_[hidden]> wrote:
> On Thu, Aug 19, 2010 at 9:53 AM, Adam Badura <a.badura_at_[hidden]> wrote:
>>   It seems Boost.Filesystem v. 3 in Boost 1.44 has some problems in
>> filesystem::path construction.
>>
>...
>>   Secondly filesystem::path accepts to much in its constructors. Currently
>> it accepts even shared_ptr. This is illustrated by following code which was
>> fine in 1.43 while in 1.44 it results in compilation error (VS 2010) of
>> ambiguous call to "fun".
>>
>> ----------------------------------------
>> #define BOOST_FILESYSTEM_VERSION 3
>> #include <boost/filesystem.hpp>
>> #include <boost/smart_ptr.hpp>
>>
>>
>> class Base
>> {
>> };
>>
>> class Derived : public Base
>> {
>> };
>>
>>
>> void fun( const boost::filesystem::path& _path )
>> {
>> }
>>
>> void fun( const boost::shared_ptr< Base >& _pBase )
>> {
>> }
>>
>>
>> int main( int argc, char* argv[] )
>> {
>>   boost::shared_ptr< Derived > pDerived( new Derived() );
>>   fun( pDerived );
>>
>>   return 0;
>> }
>
> That one will take a bit more work to solve. I've added the test case
> to path_unit_test.cpp, and will experiment with getting it to pass
> without breaking any of required use cases.

Changeset 64986 adds path_traits::is_pathable and use it to prevent
several path member templates from being considered for overload
resolution of non-pathable types. This clears the particular problem
Adam reported above.

Thanks,

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk