Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2006-08-01 13:46:24


Hi,

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. I'm right now working on the inspect tool, trying to cut
down some of its dependencies. After eliminating boost::bind, which
looks overkill to me in this case, I came upon a ironical situation: I
modified the function contains_dot() to take a reference to path
instead of a reference to string. The intent was to have a stricter
type checking:

 bool contains_dot( /*std::string const& x */ path const & p)
 {
   return p.string().find( '.' ) != std::string::npos;
 }

On the invoking code however, I forgot to remove ".string()", so I was
still passing a string to it, except that the converting constructor
(*) made everything compile anyway. As a result I was converting the
path twice, from string and then again to string. This doesn't seem an
unusual situation to me, especially when refactoring. What do you
think?

--
[ Gennaro Prota, C++ developer for hire ]

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