Boost logo

Boost :

Subject: Re: [boost] [functional] [overloaded_function] polymorphic functions?
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-03-14 18:33:34

on Wed Mar 14 2012, Gordon Woodhull <> wrote:

>> If the type of o did not involve poly, then you could pass a reference
>> to o to another translation unit where the definition of poly was not
>> visible. In that other translation unit you could call it with an
>> arbitrary type, which would have to instantiate poly::operator() without
>> sight of its definition. Therefore, I conclude that this is clearly
>> impossible.
> I had neglected the fact that overloaded_function does type erasure
> (duh). I guess this would only be possible if the polymorphic
> result_of (or equivalent) is passed to overloaded_function. Probably
> not worth it.

I think Lorenzo's assessment ("not possible") is more accurate.

Dave Abrahams
BoostPro Computing

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