Boost logo

Boost :

Subject: Re: [boost] Any interest in dynamic dispatching mechanism from & quot; interface& quot; to template functions ?
From: Raffi Enficiaud (raffi.enficiaud_at_[hidden])
Date: 2010-07-02 08:20:42


Larry Evans <cppljevans <at> suddenlink.net> writes:

>
> On 07/01/10 20:30, Larry Evans wrote:
> [snip]
> This sounds something like functor in category theory:
>
> http://en.wikipedia.org/wiki/Functor
>
> What you have is 2 functions:
>
> f_i the interface function
> f_t the template function
>
> and you want someway to convert a call to the f_i to f_t.
> So, given:
>
> t_i0 f_i(t_i1, t_i2, ..., t_in)
>
> and:
>
> t_t0 f_t(t_t1, t_t2, ..., t_tn)
>
> you want a set of conversion functions:
>
> t_tj c_j(t_ij)
>
> so that you can call:
>
> t_t0 f_t(c_1(t_i1), c_2(t_i2), ... c_n(t_in) )
>
> or something like that, right?
>
> -regards,
> Larry
>

This is the general idea, but it does not really
coincide with the notion of mathematical functor. These are
homomorphism, which means that they preserve a mathematical
structure. Well here, there is no such kind of structure I guess.
The "objects" are here the types and their specific instance.
Plus functors are arrows with one direction, while the c_i's
are bidirectional (possible update of the interface parameters
during their destruction).

The convertors preserves composition, as functors do. So I would
think about "mapping objects" rather than functors.

But the call
  t_t0 f_t(c_1(t_i1), c_2(t_i2), ... c_n(t_in) )

is exactly the idea !

Kind regards,
Raffi


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