
2 Aug
2006
2 Aug
'06
8:56 a.m.
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