Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-05-12 01:47:28


Tobias Schwinger wrote:

> 1. How to set up the client namespaces most conveniently?
>
> Too many qualified names clutter my code.
>
> I actually like the scheme the library uses but I encountered following
> portability problems on the client side:
>
> namespace a_scope
> {
> using namespace boost::fusion;
> namespace result_of { using namespace boost::fusion::result_of; }
>
> namespace mpl = boost::mpl;
>
> struct a_copy_function; // omitted for transparency
>
> namespace result_of
> {
> template<typename Seq> struct noop_transform
> : transform<typename boost::add_const<Seq>::type, a_copy_function>
> // ^^^^^^^^^ vc 7.1 and gcc 3.4 choke here
> { };
> }
>
> template<typename Seq>
> inline typename result_of::noop_transform<Seq>::type
> // ^^^^^^^^^ found ambiguous by some compilers
> // (IIRC it was gcc, couldn't reproduce the case, though)
> noop_transform(Seq const & seq)
> {
> return transform(seq, an_identity_function());
> // ^^^^^^^^^ found ambiguous by vc 8 (visible + ADL)
> }
> }

Again, I'm not sure about the best use practice. On the client side,
I would think that you will want to use Fusion, MPL, interspersed with
STL. Those libraries (esecially MPL and Fusion) have lots of names
in common. I am not sure if using directives/declarations will be
practical at all. The least I can suggest is:

     namespace mpl = boost::mpl;
     namespace fusion = boost::fusion;

Those are short prefixes already. Or maybe even:

    namespace fpl = boost::fusion; // fusion programming library. hah! :)
    namespace bfl = boost::fusion; // boost fusion library. hahah! :)

Choose your pick. I kinda like the "fpl" synonym. It jives well with
mpl and stl.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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