Thread: How to initialize an ostrstream object in a user defined class

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Don't use ostrstream, use std::ostringstream.

    Next, why do you want a stringstream as a member of the class?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #2
    Registered User
    Join Date
    Aug 2011
    Posts
    385
    Quote Originally Posted by laserlight View Post
    why do you want a stringstream as a member of the class?
    Just curious!! I was trying to derive my own class from ostrstream class such that it also contains a function for overloaded >> operator, but I couldn't declare an object of type ostrstream in my class. Is it possible??

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assertion: How to initialize a class object and use it
    By animation in forum C++ Programming
    Replies: 7
    Last Post: 03-26-2011, 04:55 AM
  2. STL Map Problem with user defined Class
    By noobcpp in forum C++ Programming
    Replies: 21
    Last Post: 07-21-2008, 12:02 PM
  3. class template user defined obj
    By terracota in forum C++ Programming
    Replies: 4
    Last Post: 06-01-2004, 08:14 AM
  4. How do you initialize a template class object?
    By adonisv in forum C++ Programming
    Replies: 5
    Last Post: 02-12-2003, 06:38 PM
  5. Requirements for using a user-defined class in STL
    By NixPhoeni in forum C++ Programming
    Replies: 8
    Last Post: 10-21-2001, 02:41 PM