Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-07-14 06:10:15


From: "Kevlin Henney" <kevlin_at_[hidden]>
> In message <003001c10c2c$7faf3e10$2101bf0a_at_[hidden]>, Corwin Joy
> <cjoy_at_[hidden]> writes
> >Proposal 1: A second "any" class which I will call anyx (for "any"
> >eXtractable).
[...]
> >...skip the obvious implementation with virtual functions etc...
>
> Actually, I don't think this is something that you can skip. What is the
> "obvious" implementation? Output is trivial, [...]

Not that trivial.

struct X {};

anyx a = X(); // error, no operator<< (std::ostream&, X const &);

This is not good. I didn't try to output a to a stream.

BTW, it is possible to define << and >> for an 'any' in a separate library
without any changes to the 'any' class itself. I have something similar
planned for variant<T> but I don't know when I'll be able to find the time.

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk