On 8/28/2011 6:17 PM, Joel Falcou wrote: > Le 06/08/2011 08:10, Eric Niebler a écrit : >> On 8/5/2011 10:55 PM, Joel falcou wrote: >>> On 06/08/11 07:30, Eric Niebler wrote: >>>> That wouldn't be enough because proto::matches "knows" about >>>> proto::switch_. It would be easy enough to extend proto::switch_ to >>>> take >>>> an optional mpl metafunction that accepts and expression and returns a >>>> type to dispatch on. It would default to proto::tag_of<mpl::_>. Or for >>>> the sake of consistency with the rest of proto, it should probably be a >>>> transform, in which case it would default to proto::tag_of<proto::_>(). >>> >>> OK >>> >>>> Could you open a feature request? >>> >>> Well, we wanted to know the correct road, i have someone to do it, so >>> let's say we'll provide you with a patch request instead ;) >> >> Even better. :-) >> > > Here is a first try: > > https://github.com/MetaScale/nt2/blob/30251fccec639a3823179fc04100fb3fba0688b2/modules/sdk/include/nt2/sdk/dsl/select.hpp > > > Not sure it is perfect but it works eemingly :)
Good. Obviously, this needs to be called switch_ instead of select_. There needs to be an appropriate default for the Transform parameter, something like tag_of<_>(). There should also be a specialization of switch_ when the transform is tag_of<_>() to make it as efficient as the current switch_ (but it should be backward-compatible without the specialization -- test this!). And of course docs and tests. > My main cocnern is can i get to remove this internediate when + result_of ? No need to replace the internal use of when, but you can access when's nested impl template directly instead of using result_of's needlessly complicated machinery. See the implementation of if_. Thanks! -- Eric Niebler BoostPro Computing http://www.boostpro.com _______________________________________________ proto mailing list proto@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/proto