|
Boost : |
From: Kevlin Henney (kevlin_at_[hidden])
Date: 2001-07-14 08:27:40
Peter Dimov writes
>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 &);
Of course this won't compile, nor is it supposed to. X does not satisfy
the additional requirements that Corwin placed on the contents of anyx:
support for << and >>. I think you may have missed the following snippet
in Corwin's proposal:
>The disadvantage of course is that the held type must support istream
>and ostream operators for "anyx" to work.
Kevlin
____________________________________________________________
Kevlin Henney phone: +44 117 942 2990
Curbralan Limited mobile: +44 7801 073 508
mailto:kevlin_at_[hidden] fax: +44 870 052 2289
http://www.curbralan.com
____________________________________________________________
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk