|
Boost : |
From: Sérgio Vale e Pace (svpace.forum_at_[hidden])
Date: 2005-01-28 07:22:27
thank´s
On Thu, 27 Jan 2005 13:47:19 +0000, Tom Widmer <tom_usenet_at_[hidden]> wrote:
> 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.
>
> Tom
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk