Click on the banner to return to the class reference home page.

basic_ostringstream


basic_ostringstreambasic_ostreambasic_iosios_base

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <sstream> 
template<class charT, class traits = char_traits<charT>,
         class Allocator = allocator<void> >
class basic_ostringstream
: public basic_ostream<charT, traits>

Description

The template class basic_ostringstream<charT,traits,Allocator> provides functionality to write to an array in memory. It supports writing objects of class basic_string<charT,traits,Allocator>. It uses a basic_stringbuf object to control the associated storage. It inherits from basic_ostream and therefore can use all the formatted and unformatted output functions.

Interface

template<class charT, class traits = char_traits<charT>,
         class Allocator = allocator<void> >
class basic_ostringstream 
: public basic_ostream<charT, traits> {

 public:

  typedef basic_stringbuf<charT, traits, Allocator> sb_type;
  typedef basic_ios<charT, traits>                  ios_type;

  typedef basic_string<charT, traits, Allocator>    string_type;

  typedef traits                           traits_type;
  typedef charT                            char_type;
  typedef typename traits::int_type        int_type;
  typedef typename traits::pos_type        pos_type;
  typedef typename traits::off_type        off_type;

  explicit basic_ostringstream(ios_base::openmode which =
                               ios_base::out);

  explicit basic_ostringstream(const string_type& str,
                               ios_base::openmode which =
                               ios_base::out);

  virtual ~basic_ostringstream();

  basic_stringbuf<charT,traits,Allocator> *rdbuf() const;
  string_type str() const;

  void str(const string_type& str);

};

Types

char_type
int_type
ios_type
off_type
ostringstream
pos_type
sb_type
string_type
traits_type
wostringstream

Constructors

explicit basic_ostringstream(ios_base::openmode which =
                             ios_base::out);
explicit basic_ostringstream(const string_type& str,
                             ios_base::openmode which =
                             ios_base::out);

Destructor

virtual ~basic_ostringstream();

Member Functions

basic_stringbuf<charT,traits,Allocator>* 
rdbuf() const;
string_type 
str() const;
void 
str(const string_type& str);

Examples

See basic_stringstream, basic_istringstream and basic_stringbuf examples.

See Also

char_traits(3C++), ios_base(3C++), basic_ios(3C++), basic_stringbuf(3C++), basic_string(3C++), basic_istringstream(3C++), basic_stringstream(3C++)

Working Paper for Draft Proposed International Standard for Information Systems--Programming Language C++, Section 27.7.2.3

Standards Conformance

ANSI X3J16/ISO WG21 Joint C++ Committee


©Copyright 1996, Rogue Wave Software, Inc.