Issue 4199: Inserters/extractors for boxed strings? (cxx_revision) Source: Triodia Technologies Pty Ltd (Mr. Michi Henning, michi(at)triodia.com) Nature: Uncategorized Issue Severity: Summary: Given valuetype WStringValue wstring; is there any requirement to have stream inserters and extractors for the boxed value type itself? The spec is currently silent on this issue. Should the following work? WStringValue ws; cin >> ws; cout << ws; Resolution: Revised Text: Actions taken: February 12, 2001: eceived issue Discussion: deferred in June 2011 to the next RTF End of Annotations:===== Date: Tue, 13 Feb 2001 07:41:43 +1000 (EST) From: Michi Henning Reply-To: C++ Revision Task Force To: C++ Revision Task Force cc: issues@omg.org Subject: Inserters/extractors for boxed strings? Message-ID: Organization: Object Oriented Concepts MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: %M=!!P~Be9hZ>e9Rb8!! This came up as part of the CORVAL2 test suite... Given valuetype WStringValue wstring; is there any requirement to have stream inserters and extractors for the boxed value type itself? The spec is currently silent on this issue. Should the following work? WStringValue ws; cin >> ws; cout << ws; Cheers, Michi. -- Michi Henning +61 7 3324 9633 Object Oriented Concepts +61 4 1118 2700 (mobile) Suite 4, 8 Martha St +61 7 3324 9799 (fax) Camp Hill 4152 michi@ooc.com.au Brisbane, AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html Sender: jon@corvette.floorboard.com Message-ID: <3A885DD0.D6C7C58C@floorboard.com> Date: Mon, 12 Feb 2001 14:04:00 -0800 From: Jon Biggar X-Mailer: Mozilla 4.75 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: C++ Revision Task Force Subject: Re: Inserters/extractors for boxed strings? References: Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: gQ^d9-&He9gJQ!!!NQ!! Michi Henning wrote: > > This came up as part of the CORVAL2 test suite... > > Given > > valuetype WStringValue wstring; > > is there any requirement to have stream inserters and extractors for the > boxed value type itself? The spec is currently silent on this issue. > > Should the following work? > > WStringValue ws; > cin >> ws; > cout << ws; There is certainly no requirement that this code work correctly at this time, and I don't think adding one would be a good idea. It would have to be a special case, since other boxed types wouldn't automatically get stream inserters or extractors. (By the way, the above code is busted--it should be "WStringValue *ws".) Also, since the code can be written as: WStringValue *ws = ...; CORBA::WString_var wsv; cin >> wsv; *ws = wsv._retn(); cout << ws->_boxed_in(); If the programmer really wants them he can define them easily: std::istream &operator >>(std::istream &istr, WStringValue *ws) { CORBA::WString_var wsv; istr >> wsv; *ws = wsv._retn(); return istr; } std::ostream &operator <<(std::ostream &ostr, WStringValue *ws) { return ostr << ws->_boxed_in(); } Inserter & extractor operations were defined by the C++ language mapping for String_var et al because, although it is possible to write them portably using just the C++ standard and CORBA language mapping, an implementation provided by the ORB vendor is likely to be more efficient, since it might be able to take advantage of the knowledge of the implementation strategy of the String_var class. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Date: Tue, 13 Feb 2001 08:22:31 +1000 (EST) From: Michi Henning To: Jon Biggar cc: C++ Revision Task Force Subject: Re: Inserters/extractors for boxed strings? In-Reply-To: <3A885DD0.D6C7C58C@floorboard.com> Message-ID: Organization: Object Oriented Concepts MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: 2kM!!l\)!!5=n!!RL?!! On Mon, 12 Feb 2001, Jon Biggar wrote: > There is certainly no requirement that this code work correctly at this > time, and I don't think adding one would be a good idea. It would have > to be a special case, since other boxed types wouldn't automatically get > stream inserters or extractors. I agree with that. > (By the way, the above code is busted--it should be "WStringValue *ws".) Strike 32! ;-) Cheers, Michi. -- Michi Henning +61 7 3324 9633 Object Oriented Concepts +61 4 1118 2700 (mobile) Suite 4, 8 Martha St +61 7 3324 9799 (fax) Camp Hill 4152 michi@ooc.com.au Brisbane, AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html