Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-05-16 13:54:43


Joel de Guzman wrote:
> Tobias Schwinger wrote:
>
>>Tobias Schwinger wrote:
>>
>>>* Design
>>>
>>>1. I'm missing an extension point in the generators to turn them into a
>>>type-preserving variadic input facility. Elaboration:
>>>
>>>Currently e.g. "make_vector" is an inline function. My suggestion is to turn it into
>>>a global constant of the type of a class template instantiation e.g. "vector_generator<F>".
>>>
>>> vector_generator<identity_function> const make_vector = ...
>>>
>>>This way it's easy to create user-defined function objects, that take a variable number
>>>of arguments, turn them into a tuple and finally use this information to create a
>>>user-defined object (that is, entirely without using Boost.PP). Of course that beast
>>>would be able to take a stateful functor in its ctor.
>>
>>Hmmm -- I had hoped for a comment on this one...
>>Did my review read too negative? Was something unclear?
>
>
> I think we just missed it. Sorry.

I recently noticed that (at least) the gmane web interface seems to have
problems catching all messages -- maybe /some clients/ missed it...

> Yes, I think your proposal makes sense. That in fact is the very
> essence of Phoenix. Let me think about it some more to see how
> it would fit in the overall picture.

Here's a naive "bind" in pseudo Fusion, just for the taste of it:

  gen_tuple<make_bound_func> bind;

  make_bound_func(tuple binding)
  {
    return gen_tuple< bound_func<tuple> >(bound_func(binding));
  }

  bound_func<binding_tuple>[state: binding_tuple binding](tuple in)
  {
    return unpack_args( front(binding),
      transform(pop_front(binding), if_(is_ph(_), in[ph_index(_)], _ )) );
  }

> At the very least, I like it.

Thanks,

Tobias


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