Boost logo

Boost :

From: Tom Widmer (tom_usenet_at_[hidden])
Date: 2005-01-27 08:47:19

Sérgio Vale e Pace wrote:
> Tom Widmer wrote:
>>Anything is convertible to boost::any, and since you have an operator<<
>>for boost::any, it will catch any object that doesn't have a better
>>matched operator<< (i.e. any one that doesn't require a user defined
>>conversion). If this didn't happen, you'd just get a compiler error when
>>you tried to create an any<A>, since creation of that requires
>>instantiation of all virtual functions of holder<A>, including the
>>ill-formed print member (e.g. no overload matches the call out<<held).
> that explains it, thank's
>>Dispatching to some kind of default call (which might just set failbit
>>on the stream, or you could make it configurable) is probably the best
>>way to handle this.
> could you elaborate on that, what do you mean by defaul call?

Every instantiation of holder will have to have a valid, compilable
print member, since virtual functions are instantiated even if they
aren't used. So, where a type isn't streamable, you need some kind of
default behaviour for print just to get the code to compile. I suggested
setting failbit on the stream, but you may prefer something else, or to
make it configurable.


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