From: Pavol Droba (droba_at_[hidden])
Date: 2004-02-18 13:14:44
On Wed, Feb 18, 2004 at 05:23:29PM +0000, Reece Dunn wrote:
> Stefan Slapeta wrote:
> >Pavol Droba wrote:
> >>It is not really reasonable to await from
> >> a user to always type boost::algorithm::string::trim.
> >Maybe it could help a little bit to replace 'algorithm' by 'algo' and
> >'string' by 'str'.
> >IMHO, also shorter namespaces like 'boost::filesystem' have the problem of
> >beeing too long to be used on every access. Long typenames like
> >boost::filesystem::directory_iterator have a very high capability to make
> >the code unreadable very quickly.
> why not use:
> namespace sa = boost::algorithm::string;
> sa::trim( ... );
> namespace fs = boost::filesystem;
> fs::directory_iterator di = ...;
> Surely this gives you what you are after (shorter namespace names) without
> modifying the namespace currently used by the library (which will break
> existing code that uses the libraries).
> This is what namespace aliases are for and is used for the filesystem
> library in the regression test implementation.
Namespace aliasing is common practice, but the problem with the algorithm namespace
If there would be just one boost::algorithm and everything inside it, than aliasing
would work just fine. But imagine having
It is easy to get lost in such a lot of namespace. One would have to look into the docs
to see which algoritm lies in which namespace. It could realy be painful.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk