The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.lang.c++
From: jcof...@rmii.com (Jerry Coffin)
Date: 1995/11/13
Subject: Re: Should I derive from ostrstream?
[ ... ]
>> the original poster wants to do two very simple things: If size of implementation enters into the question, I think simply >> - assemble a database query using the shift operators >> - read the result provided from the database using the shift operators >Maybe you can read thoughts; I can't. From the posters first article, >I can only see that he wants his class to behave like an ostrstream. >Apparently there is a reason for it: He already has a function >'execute' which interprets a string as a database query. He didn't >say a word about reading the result from the database. If he really >means what you said, deriving from streambuf is clearly the right >thing. If he just means what he said, notice that my approach is >MUCH shorter than yours. There are at maximum 20 shift operator >functions to write (in fact, I think he'll need less than 10), >and by using a macro this can be done in about 1 minute. implementing this as a manipulator for ostrstream would be by far the shortest code: ostrstream &execute(ostrstream &s) } ostrstream &operator<<(ostrstream &s,ostrstream &(*m)(ostrstream &s)) { return m(s); } used something like: ostrstream x; I'm not sure I'd consider this _better_ than deriving a new class, but /* I can barely express my own opinions; I certainly can't You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||