NAMD
Main Page
Namespaces
Classes
Files
Class List
Class Index
Class Hierarchy
Class Members
Protected Member Functions
|
List of all members
CkPrintf_stringbuf Class Reference
Inheritance diagram for CkPrintf_stringbuf:
Protected Member Functions
virtual int
sync
()
Detailed Description
Definition at line
23
of file
InfoStream.C
.
Member Function Documentation
int CkPrintf_stringbuf::sync
(
)
protected
virtual
Definition at line
37
of file
InfoStream.C
.
37
{
38
// Even though str() returns a *copy* of the string, the RHS rules
39
// should avoid doing two copies for assignment to infostr.
40
//
41
// Note that str().c_str() should be avoided due to possibility for
42
// leaving a dangling pointer or undefined behavior at best, e.g.,
43
// https://stackoverflow.com/questions/21034834/is-there-issue-will-stringstream-str-c-str
44
// Copying into a named temporary is considered good practice.
45
std::string infostr = str();
46
CkPrintf(
"%s"
,infostr.c_str());
47
#ifndef NAMD_NO_STDOUT_FLUSH
48
fflush(stdout);
// since CkPrintf doesn't always flush
49
#endif
50
str(
""
);
51
return
0;
52
}
The documentation for this class was generated from the following file:
InfoStream.C
Generated by
1.8.5