Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-06-07 16:24:29

On Sat, Jun 7, 2008 at 12:36 PM, Mathias Gaunard
<mathias.gaunard_at_[hidden]> wrote:
> Giovanni Piero Deretta wrote:
>> I see two completely orthogonal fuctionalities here:
>> 1- type erasure with multiple signatures of a single function object
>> 2- aggregating different function objects in a single polymorphic
>> function object *without* any type erasure at all.
> That's what I've been saying for quite a while. MSF tries to do both,
> but should only provide the first.
> The second should be another tool, like egg::overload.
> That kind of tool needs a lot of work alone.
> I personally do not find egg::overload very satisfying. Lots of macros,
> separate type definition and usage...
> A solution like
> seems
> more elegant to me.

Ah yes! I already had that thread bookmarked :)

> The problem being that it's not really possible, because the reflection
> mechanism used by function objects doesn't allow rewriting their
> signatures to forward to them.

Could you elaborate?

> Ideally, a system that works even with polymorphic functions would be
> best, and if it doesn't require enumerating the signatures (they could
> be deduced) even better.
> By the way, is it possible to deduce the constraints of an argument type
> and apply concept checking with SFINAE within a lambda expression DSEL?

For all operators that a DSEL implements, it already knows the
required concepts (addable, dereferenciable, etc...), so it can
remember every possible operation on every placeholder and carry it to
the top level expression; then it can use sfinae on the union of all
requirements of each placeholder.

For more complex stuff (i.e. bind), it would be much harder: I have no
idea if you can extract concepts from function signatures arguments as
you can with types (at least without some kind registration). In C++
metaprogramming world, types are first class as you can have type
variables (i.e. template type arguments), but I still can't see how
you can store a concept in a (metaprogramming) variable.


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