
"Daniel Wallin" <dalwan01@student.umu.se> wrote
Andy Little wrote:
"Daniel Wallin" <dalwan01@student.umu.se> 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 suitable. result_of_plus<myClass,myClass>::type t = x+y; which has clarified only after reading Joel de Guzmans type-deduction.hpp header. Though perhaps this might work: result_of<myClass, '+' , myClass>::type t = x+y; or result_of< operator_<'+'>,myClass,myClass >::type t = x + y; maybe I'll experiment with that. regards Andy Little