Boost logo

Boost :

Subject: Re: [boost] [local] Help for the Alternatives section
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-05-07 12:00:39

On Sun, May 1, 2011 at 6:46 PM, Mathias Gaunard
<mathias.gaunard_at_[hidden]> wrote:
> There is also the polymorphism thing: functions generated by Boost.Local are
> necessarily monomorphic, unlike Boost.Phoenix and global functors.

On Fri, May 6, 2011 at 10:49 AM, Lorenzo Caminiti <lorcaminiti_at_[hidden]> wrote:
> void BOOST_LOCAL_FUNCTION(types(const double&, const std::string&)
> num, const bind& sep, { // (1)
>    std::cout << num << std::endl;
> l(1.23);
> l("abc");
>>> This is more overloading than polymorphism... bus still:
>>> 1) Compiles on ISO C++.
>>> 2) Declares l locally (information hiding).
>>> 3) Does not repeat l declaration multiple times (avoid code duplication).
>>> 4) l is """effectively polymorphic""" (in between _many_ quotes :) ) in its
>>> argument type num as it accepts both doubles and std::strings (but no more
>>> than these two types :( ). (I will not actually claim that such a local
>>> function l polymorphic in num's type.)
> Does anyone else think this feature is useful??
> This is _not_ trivial to implement so I won't do it unless you guys
> think it is useful. I might just document it as a possibility in the
> docs and implement it only if the library gets accepted...

Hello Mathias, I'm curious if you have an opinion about the usefulness
of Boost.Local supporting multiple types (but not generic types) for
its function parameters.

Thank you very much.


Boost list run by bdawes at, gregod at, cpdaniel at, john at