🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1735

basic_string conversions

#1735
From: Steve F. Cipolli
Date: Fri, 18 Aug 1995 06:51
24 lines
1232 bytes
Distribution:
What is the recommended method of converting basic_string's of one 
parameterized type to another, and from another parameterized type itself.  
To clarify:

char *ntbs = "abc";
wchar_t *ntcws = L"abc";
string cs(ntbs);	// basic_string<char>(char *) - OK
wstring ws1(ntcws);	// basic_string<wchar_t>(wchar_t *) - OK
wstring ws2(ntbs);	// basic_string<wchar_t>(char *) - ???? 
wstring ws3(cs);	// basic_string<wchar_t>(basic_string<char>) - ???? 

Will the last two constructors work.  If so how?
If not, is the <cwchar> conversion function btowc from the C libray the answer?

Stephen Cipolli
Datascope Corp.
sfc@datascope.com


---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <MATT.95Aug17235138@physics2.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: dscope!sfc@uu.psi.com (Steve F. Cipolli)
Newsgroups: comp.std.c++
Subject: basic_string conversions
Date: 18 Aug 1995 06:51:38 GMT
Organization: Datascope
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <MATT.95Aug17235138@physics2.Berkeley.EDU>
NNTP-Posting-Host: physics2.berkeley.edu