std::string
Document number: | N1802=05-0062 |
Date: | 2005-04-18 |
Project: | Programming Language C++ |
Reference: | ISO/IEC IS 14882:2003(E) |
Reply to: | Pete Becker |
Dinkumware, Ltd. | |
[email protected] |
There are seventeen places in the C++ Standard Library where we use char*
strings in the interface; in each of these places we can add an overload that takes
an object of type std::string
.
In [lib.locale], 22.1.1, add the following constructors:
explicit locale(string std_name); locale(const locale& other, string std_name, category);
In [lib.locale.cons], 22.1.1.2, after the entry for explicit locale(const
char * std_name)
, add the following:
Effects: the same asexplicit locale(string std_name);
locale(std_name.c_str())
.
In [lib.locale.cons], 22.1.1.2, after the entry for locale(const locale&
other, const char* std_name, category)
, add the following:
Effects: the same aslocale(const locale& other, string std_name, category cat);
locale(other, std_name.c_str(), cat)
.
In [lib.locale.facet], 22.1.1.1.2, paragraph 4, after the sentence "Each such facet
provides a constructor that takes a const char*
argument, which names
the locale, and a refs argument, which is passed to the base class constructor"
add the following sentence:
Each such facet also provides a constructor that takes astring
argument str and a refs argument, which has the same effect as calling the first constructor with the two argumentsstr.c_str()
andrefs
.
In [lib.locale.ctype.byname], 22.2.1.2, after the declaration of the constructor, add the following constructor:
explicit ctype_byname(string, size_t refs = 0);
In [lib.locale.codecvt.byname], 22.2.1.5, after the declaration of the constructor, add the following constructor:
explicit codecvt_byname(string, size_t refs = 0);
In [lib.locale.numpunct.byname], 22.2.3.2, after the declaration of the constructor, add the following constructor:
explicit numpunct_byname(string, size_t refs = 0);
In [lib.locale.collate.byname], 22.2.4.2, after the declaration of the constructor, add the following constructor:
explicit collate_byname(string, size_t refs = 0);
In [lib.locale.time.get.byname], 22.2.5.2, after the declaration of the constructor, add the following constructor:
explicit time_get_byname(string, size_t refs = 0);
In [lib.locale.time.put.byname], 22.2.5.4, after the declaration of the constructor, add the following constructor:
explicit time_put_byname(string, size_t refs = 0);
In [lib.locale.moneypunct.byname], 22.2.6.4, after the declaration of the constructor, add the following constructor:
explicit moneypunct_byname(string, size_t refs = 0);
In [lib.locale.messages.byname], 22.2.7.2, after the declaration of the constructor, add the following constructor:
explicit messages_byname(string, size_t refs = 0);
In [lib.filebuf], 27.8.1.1, add the following declaration after the declaration of
the member function open
:
basic_filebuf
*open(string s, ios_base::openmode mode);
In [lib.filebuf.members], 27.8.1.3, add the following after paragraph 5:
basic_filebuf
*open(string s, ios_base::openmode mode); Returns:
open(s.c_str(), mode);
In [lib.ifstream], 27.8.1.5, add the following declarations to the declaration of
basic_ifstream
:
explicit basic_ifstream(string s, ios_base::openmode mode = ios_base::in); void open(string s, ios_base::openmode mode = ios_base::in);
At the end of [lib.ifstream.cons], 27.8.1.6, add the following:
explicit basic_ifstream(string s, ios_base::openmode mode = ios_base::in);
Effects: the same as
basic_ifstream(s.c_str(), mode);
In [lib.ifstream.members], 27.8.1.7, after the entry for open
, add
the following:
void open(string s, ios_base::openmode mode = ios_base::in);
Effects: calls open(s.c_str(), mode);
In [lib.ofstream], 27.8.1.8, add the following declarations to the declaration of
basic_ofstream
:
explicit basic_ofstream(string s, ios_base::openmode mode = ios_base::out); void open(string s, ios_base::openmode mode = ios_base::out);
At the end of [lib.ofstream.cons], 27.8.1.9, add the following:
explicit basic_ofstream(string s, ios_base::openmode mode = ios_base::out);
Effects: the same as
basic_ofstream(s.c_str(), mode);
In [lib.ofstream.members], 27.8.1.10, after the entry for open
, add
the following:
void open(string s, ios_base::openmode mode = ios_base::out);
Effects: calls open(s.c_str(), mode);
In [lib.fstream], 27.8.1.11, add the following declarations to the declaration of
basic_fstream
:
explicit basic_fstream(string s, ios_base::openmode mode = ios_base::in | ios_base::out); void open(string s, ios_base::openmode mode = ios_base::in | ios_base::out);
At the end of [lib.fstream.cons], 27.8.1.12, add the following:
explicit basic_fstream(string s, ios_base::openmode mode = ios_base::in | ios_base::out);
Effects: the same as
basic_fstream(s.c_str(), mode);
In [lib.fstream.members], 27.8.1.13, after the entry for open
, add
the following:
void open(string s, ios_base::openmode mode = ios_base::in | ios_base::out);
Effects: calls open(s.c_str(), mode);