Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-02-03 05:54:42

"Daniel Wallin" <dalwan01_at_[hidden]> wrote
> Andy Little wrote:
> > "Daniel Wallin" <dalwan01_at_[hidden]> wrote
> >
> >>Andy Little wrote:
> >>
> > Presumably you would consider it a grave offence if examples of this bad
> > practise 'using namespace mpl;' were to be found in the boost library
> > itself?
> Yes, unless it's done locally in a function or a separate compilation
> unit of course. The point is that the user that introduces the name
> clashes by bringing in the names into the same namespace should deal
> with the problem.

If mpl is not exposed as part of the user interface, then there will be no
temptation to do this.
Which incidentally solves a lot of problems and renders the mpl operators in
the title of this thread unnecessary for my library
I have had some confusion about the purpose of (say) mpl::plus.
When used like this:

boost::mpl::plus<int_<1>,int_<1> >::type.

It is a compile time operation on the internal values of the int_'s

However I have been trying to use it like this:

myClass x;
myClass y;

boost::mpl::plus<myClass,myClass>::type t = x+y;

In this situation a different compile time function name would seem more

result_of_plus<myClass,myClass>::type t = x+y;

which has clarified only after reading Joel de Guzmans type-deduction.hpp

Though perhaps this might work:

 result_of<myClass, '+' , myClass>::type t = x+y;
result_of< operator_<'+'>,myClass,myClass >::type t = x + y;

maybe I'll experiment with that.

Andy Little

Boost list run by bdawes at, gregod at, cpdaniel at, john at