Boost logo

Boost :

From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2005-01-04 06:23:01


Aleksey Gurtovoy wrote:
> Daniel Wallin writes:
>
>>>>I'm sorry if I'm being thick here, but I can't grasp this. To me protect
>>>> looks exactly like what is needed here. I have always thought of
>>>>protect as delaying the placeholder substitution one step,
>
>>
>>
>> Well, again, it's not what it does. If we are to talk about introducing
>> another primitive that would cover the OP use case, then it's another
>> discussion (which should be taken to the developers list).

Well OK, let's do that. What are your thoughts about adding something
like this?

  template<
        typename BOOST_MPL_AUX_NA_PARAM(T)
>
  struct unlambda
  {
      template<
            typename X = na
          BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(1, typename X, na)
>
      struct apply
      {
          typedef T type;
      };

      typedef unlambda type;
  };

  ...

  /// special case for 'unlambda'
  template< typename T, typename Tag >
  struct lambda< mpl::unlambda<T>,Tag, int_<1> >
  {
      typedef true_ is_le;
      typedef mpl::bind0<mpl::unlambda<T> > result_;
      typedef result_ type;
  };

-- 
Daniel Wallin

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