Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-10-22 08:30:51


On Wed, 22 Oct 2003 09:33:59 +0200, Pavol Droba wrote
> > Now for a few new issues:
> > 1) Any reason why we can't put all functions in namespace
> > boost::string_algo
> > (or boost::algorithm::string)? I found it a little tricky to
> > figure out which things were boost versus string_algo.
>
> There are more resons for separation of functions in different namespaces.
>
> - First is a logical decomposition.
> Ordinary user should be able to find all functionality
> in the namespace boost...more deleted...

Yes, I read that in the documentation. But what I'm saying is that my 'usage'
experience didn't match with this decomposition. When I have a string
processing problem to solve I don't want to have to figure out what to figure
these layers out, that's all.

> - Second resons is syntactical. If all functions would be in one
> namespace, there is a big probablility of name clashes. Because the
> majority of arguments in the algorithms is templated, the only
> distintion between different variants of the same algorithm is the
> number of paramters. So putting everything into one namespace would
> most probably imply the need to rename some functions.

I would be an interesting experiment that I would like to see happen.

> The need for the simple table in docs, showing the list of
> algorithms and their variants, was already identified. Such a table
> would simplify the orientation in namespaces.

Well sure, but if you have to add the namespace into the table it is harder to
use.
 
> > 2) On a related front, I don't really care for the find.hpp, find2.hpp,
> > replace.hpp, replace2.hpp dichotomy. As a user I think of using find. There
> > are several variations, some more complex than others. But 'find2' doesn't
> > give me any clues as to when I need to include find2.hpp version find.hpp.
> > Perhaps find_generic.hpp instead? Or maybe everything in find.hpp? (Note that
> > in my reading of the source it appears that all of the zzzz2.hpp headers are
> > always included in the zzzz.hpp header anyway).
>
> This separation follows the idea of namespaces. xxx2.hpp contains
> string_algo layer stuff. It is always included by the xxx.hpp
> headers. boost namespace algorithms are mostly only a simple wrapper
> of a generic siblings.
>
> If you don't want to bother, simply include <boost/string_algo.hpp>
> (or string_algo.regex.hpp) and you have all the functionality available.

I think if you are going to do this you should have
  boost/string_algo/find.hpp //top layer stuff
  boost/string_algo/string_algo/find.hpp //lower layer? stuff
or something to flag separate that layer. It seems pretty clear from the
implementation though that I'll never have to include find2.hpp directly since
it is already included for me by find.hpp.

Jeff


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