From: Pavol Droba (droba_at_[hidden])
Date: 2003-10-20 11:44:19
On Mon, Oct 20, 2003 at 10:07:42AM -0400, Jeff Flinn wrote:
> It looks like my suggestion was missed for using namespaces rather than
> #include <boost/string_algo.hpp>
> void SomeInplaceStringFnc()
> using namespace boost::string_algo;
> trim(to_upper("SomeStuff") ); // error - not defined in this namespace
> using namespace in_place; // I'm an in_place kind of guy
> ::FunctionOperatingOnAString( trim(to_upper("SomeStuff") ) )
> std::string str1(" hello world! ");
> std::string str2 = copy::ireplace_first( str1, "hello", "goodbye" );
> + Doesn't play favorites for defaults
> + Does explicity identify the less used mutating/copying usage
> + Doesn't play favorites over performance/safety
> + Doesn't presuppose what is the common task for every user and every
> other pluses
> + Uses a common C++ facility in it's intended fashion.
> + Reduces complexity of both usage and implementation.
> + Makes structure of code and documentation more consistent.
This looks like a working solution, but it has one flaw. It is quite common, that
mutable and copy variants are both used in the code. Therefore at the end you
would have to specify the namespace explicitly. This would lead to the same problem
as the renaming.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk