You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2007/04/30 21:26:14 UTC
svn commit: r533832 - /incubator/stdcxx/trunk/doc/stdlibref/codecvt.html
Author: sebor
Date: Mon Apr 30 12:26:07 2007
New Revision: 533832
URL: http://svn.apache.org/viewvc?view=rev&rev=533832
Log:
2007-04-30 Martin Sebor <se...@roguewave.com>
STDCXX-399
* codecvt.html: Zero-initialized mbstate_t variable in example code
before passing it to codecvt::in() and codecvt::out() (as done in
revision 533806. Replaced std::endl with '\n' for efficiency.
Modified:
incubator/stdcxx/trunk/doc/stdlibref/codecvt.html
Modified: incubator/stdcxx/trunk/doc/stdlibref/codecvt.html
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/doc/stdlibref/codecvt.html?view=diff&rev=533832&r1=533831&r2=533832
==============================================================================
--- incubator/stdcxx/trunk/doc/stdlibref/codecvt.html (original)
+++ incubator/stdcxx/trunk/doc/stdlibref/codecvt.html Mon Apr 30 12:26:07 2007
@@ -357,14 +357,13 @@
//
#include <iostream>
-
#include <codecvte.h>
int main ()
{
- // not used, must be supplied to facet
- std::mbstate_t state;
+ // not used, must be zero-initialized and supplied to facet
+ std::mbstate_t state = std::mbstate_t ();
// three strings to use as buffers
std::string
@@ -375,9 +374,9 @@
// Print initial contents of buffers
std::cout << "Before:\n"
- << ins << std::endl
- << ins2 << std::endl
- << outs << std::endl << std::endl;
+ << ins << '\n'
+ << ins2 << '\n'
+ << outs << "\n\n";
// Create a user defined codecvt facet
// This facet converts from ISO Latin Alphabet No. 1
@@ -402,9 +401,12 @@
outs.length(), out_next);
std::cout << "After in:\n"
- << ins << std::endl
- << ins2 << std::endl
- << outs << std::endl << std::endl;
+ << ins << '\n'
+ << ins2 << '\n'
+ << outs << "\n\n";
+
+ // zero-initialize (unused) state object
+ state = std::mbstate_t ();
// Finally, convert back to the original codeset
@@ -413,9 +415,9 @@
&ins[0] + ins.length(), in_next);
std::cout << "After out:\n"
- << ins << std::endl
- << ins2 << std::endl
- << outs << std::endl;
+ << ins << '\n'
+ << ins2 << '\n'
+ << outs << '\n';
return 0;
}