Commit 0a6e98b7 by Jonathan Wakely Committed by Jonathan Wakely

Remove ios_mode::trunc from basic_ofstream openmode arguments

	* include/std/fstream (basic_ifstream, basic_ofstream, basic_fstream):
	Remove outdated comments about calling c_str() to create a file stream
	from a std::string.
	(basic_ofstream::basic_ofstream, basic_ofstream::open): Remove
	redundant ios_mode::trunc bits from default arguments and comments.

From-SVN: r254226
parent 791929c9
2017-10-30 Jonathan Wakely <jwakely@redhat.com> 2017-10-30 Jonathan Wakely <jwakely@redhat.com>
* include/std/fstream (basic_ifstream, basic_ofstream, basic_fstream):
Remove outdated comments about calling c_str() to create a file stream
from a std::string.
(basic_ofstream::basic_ofstream, basic_ofstream::open): Remove
redundant ios_mode::trunc bits from default arguments and comments.
* doc/xml/faq.xml: Adjust "What is libstdc++?" answer slightly. * doc/xml/faq.xml: Adjust "What is libstdc++?" answer slightly.
* include/bits/hashtable_policy.h: Include <tuple>. * include/bits/hashtable_policy.h: Include <tuple>.
......
...@@ -506,9 +506,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -506,9 +506,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __mode Open file in specified mode (see std::ios_base). * @param __mode Open file in specified mode (see std::ios_base).
* *
* @c ios_base::in is automatically included in @a __mode. * @c ios_base::in is automatically included in @a __mode.
*
* Tip: When using std::string to hold the filename, you must use
* .c_str() before passing it to this constructor.
*/ */
explicit explicit
basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in) basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
...@@ -622,9 +619,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -622,9 +619,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* *
* Calls @c std::basic_filebuf::open(s,__mode|in). If that function * Calls @c std::basic_filebuf::open(s,__mode|in). If that function
* fails, @c failbit is set in the stream's error state. * fails, @c failbit is set in the stream's error state.
*
* Tip: When using std::string to hold the filename, you must use
* .c_str() before passing it to this constructor.
*/ */
void void
open(const char* __s, ios_base::openmode __mode = ios_base::in) open(const char* __s, ios_base::openmode __mode = ios_base::in)
...@@ -738,15 +732,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -738,15 +732,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __s Null terminated string specifying the filename. * @param __s Null terminated string specifying the filename.
* @param __mode Open file in specified mode (see std::ios_base). * @param __mode Open file in specified mode (see std::ios_base).
* *
* @c ios_base::out | @c ios_base::trunc is automatically included in * @c ios_base::out is automatically included in @a __mode.
* @a __mode.
*
* Tip: When using std::string to hold the filename, you must use
* .c_str() before passing it to this constructor.
*/ */
explicit explicit
basic_ofstream(const char* __s, basic_ofstream(const char* __s,
ios_base::openmode __mode = ios_base::out|ios_base::trunc) ios_base::openmode __mode = ios_base::out)
: __ostream_type(), _M_filebuf() : __ostream_type(), _M_filebuf()
{ {
this->init(&_M_filebuf); this->init(&_M_filebuf);
...@@ -759,12 +749,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -759,12 +749,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __s std::string specifying the filename. * @param __s std::string specifying the filename.
* @param __mode Open file in specified mode (see std::ios_base). * @param __mode Open file in specified mode (see std::ios_base).
* *
* @c ios_base::out | @c ios_base::trunc is automatically included in * @c ios_base::out is automatically included in @a __mode.
* @a __mode.
*/ */
explicit explicit
basic_ofstream(const std::string& __s, basic_ofstream(const std::string& __s,
ios_base::openmode __mode = ios_base::out|ios_base::trunc) ios_base::openmode __mode = ios_base::out)
: __ostream_type(), _M_filebuf() : __ostream_type(), _M_filebuf()
{ {
this->init(&_M_filebuf); this->init(&_M_filebuf);
...@@ -777,13 +766,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -777,13 +766,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __s filesystem::path specifying the filename. * @param __s filesystem::path specifying the filename.
* @param __mode Open file in specified mode (see std::ios_base). * @param __mode Open file in specified mode (see std::ios_base).
* *
* @c ios_base::out | @c ios_base::trunc is automatically included in * @c ios_base::out is automatically included in @a __mode.
* @a __mode.
*/ */
template<typename _Path, typename = _Require< template<typename _Path, typename = _Require<
is_constructible<__filebuf_type, const _Path&, ios_base::openmode>>> is_constructible<__filebuf_type, const _Path&, ios_base::openmode>>>
basic_ofstream(const _Path& __s, ios_base::openmode __mode basic_ofstream(const _Path& __s,
= ios_base::out|ios_base::trunc) ios_base::openmode __mode = ios_base::out)
: basic_ofstream(__s.c_str(), __mode) : basic_ofstream(__s.c_str(), __mode)
{ } { }
#endif // C++17 #endif // C++17
...@@ -857,15 +845,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -857,15 +845,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __s The name of the file. * @param __s The name of the file.
* @param __mode The open mode flags. * @param __mode The open mode flags.
* *
* Calls @c std::basic_filebuf::open(__s,__mode|out|trunc). If that * Calls @c std::basic_filebuf::open(__s,__mode|out). If that
* function fails, @c failbit is set in the stream's error state. * function fails, @c failbit is set in the stream's error state.
*
* Tip: When using std::string to hold the filename, you must use
* .c_str() before passing it to this constructor.
*/ */
void void
open(const char* __s, open(const char* __s, ios_base::openmode __mode = ios_base::out)
ios_base::openmode __mode = ios_base::out | ios_base::trunc)
{ {
if (!_M_filebuf.open(__s, __mode | ios_base::out)) if (!_M_filebuf.open(__s, __mode | ios_base::out))
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
...@@ -881,12 +865,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -881,12 +865,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __s The name of the file. * @param __s The name of the file.
* @param __mode The open mode flags. * @param __mode The open mode flags.
* *
* Calls @c std::basic_filebuf::open(s,mode|out|trunc). If that * Calls @c std::basic_filebuf::open(s,mode|out). If that
* function fails, @c failbit is set in the stream's error state. * function fails, @c failbit is set in the stream's error state.
*/ */
void void
open(const std::string& __s, open(const std::string& __s, ios_base::openmode __mode = ios_base::out)
ios_base::openmode __mode = ios_base::out | ios_base::trunc)
{ {
if (!_M_filebuf.open(__s, __mode | ios_base::out)) if (!_M_filebuf.open(__s, __mode | ios_base::out))
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
...@@ -978,9 +961,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -978,9 +961,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @brief Create an input/output file stream. * @brief Create an input/output file stream.
* @param __s Null terminated string specifying the filename. * @param __s Null terminated string specifying the filename.
* @param __mode Open file in specified mode (see std::ios_base). * @param __mode Open file in specified mode (see std::ios_base).
*
* Tip: When using std::string to hold the filename, you must use
* .c_str() before passing it to this constructor.
*/ */
explicit explicit
basic_fstream(const char* __s, basic_fstream(const char* __s,
...@@ -1091,9 +1071,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1091,9 +1071,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* *
* Calls @c std::basic_filebuf::open(__s,__mode). If that * Calls @c std::basic_filebuf::open(__s,__mode). If that
* function fails, @c failbit is set in the stream's error state. * function fails, @c failbit is set in the stream's error state.
*
* Tip: When using std::string to hold the filename, you must use
* .c_str() before passing it to this constructor.
*/ */
void void
open(const char* __s, open(const char* __s,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment