Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-08-02 04:56:27


Gennaro Prota wrote:

> I don't know if this has been discussed in the LWG but I'd like to
> make
>
> basic_path(const string_type& s); // (*)
>
> explicit.

Let's look at your example to see why it isn't explicit.

Here is the signature:

    bool contains_dot( path const & p);

Users will certainly expect the following to work:

    assert( contains_dot( "foo.bar" ) );

I maintain that they also will expect the following to work:

    std::string foo( "foo.bar" );

    ... // much intervening code

    assert( contains_dot( foo ) );

I really don't think we want to force users to write:

    assert( contains_dot( path(foo) ) );

So the constructor can't be explicit.

--Beman


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