Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
tests
regress
27.stringbuf.xsputn.stdcxx-576.cpp
Go to the documentation of this file.
1
27
#include <sstream>
// for stringbuf
28
#include <string>
// for string
29
#include <cassert>
// for assert()
30
31
struct
PubBuf
: std::stringbuf
32
{
33
char
*
Pbase
()
const
{
return
this->pbase (); }
34
};
35
36
int
main
()
37
{
38
// 512 is the default buffer size of the basic_stringbuf
39
std::string
s
(512,
'a'
);
40
41
std::stringbuf sbuf (
s
);
42
PubBuf
&
buf
= (
PubBuf
&)sbuf;
43
44
std::streamsize
res
=
buf
.sputn (
buf
.Pbase (), 128);
45
s
.append (
s
.begin (),
s
.begin () + 128);
46
47
const
std::string&
str
=
buf
.str ();
48
49
assert
(
res
== 128);
50
assert
(
str
.size () ==
s
.size ());
51
assert
(
str
==
s
);
52
53
return
0;
54
}
res
#define res
Definition
17.names.cpp:531
buf
#define buf
Definition
17.names.cpp:452
s
#define s
Definition
rw_alg_test.h:221
main
int main()
Definition
27.stringbuf.xsputn.stdcxx-576.cpp:36
assert
#define assert(expr)
Definition
_cassert.h:40
str
const char * str
Definition
exec.cpp:170
PubBuf
Definition
27.stringbuf.virtuals.cpp:55
PubBuf::Pbase
char * Pbase() const
Definition
27.stringbuf.xsputn.stdcxx-576.cpp:33
Generated by
1.9.8