Init
This commit is contained in:
359
cppdraft/std/exceptions.md
Normal file
359
cppdraft/std/exceptions.md
Normal file
@@ -0,0 +1,359 @@
|
||||
[std.exceptions]
|
||||
|
||||
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
|
||||
|
||||
## 19.2 Exception classes [std.exceptions]
|
||||
|
||||
### [19.2.1](#general) General [[std.exceptions.general]](std.exceptions.general)
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L31)
|
||||
|
||||
The C++ standard library provides classes to be used to report certain errors ([[res.on.exception.handling]](res.on.exception.handling "16.4.6.14 Restrictions on exception handling")) in
|
||||
C++ programs[.](#general-1.sentence-1)
|
||||
|
||||
In the error model reflected in these classes, errors are divided into two
|
||||
broad categories:[*logic*](#def:logic) errors and[*runtime*](#def:runtime) errors[.](#general-1.sentence-2)
|
||||
|
||||
[2](#general-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L41)
|
||||
|
||||
The distinguishing characteristic of logic errors is that they are due to errors
|
||||
in the internal logic of the program[.](#general-2.sentence-1)
|
||||
|
||||
In theory, they are preventable[.](#general-2.sentence-2)
|
||||
|
||||
[3](#general-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L46)
|
||||
|
||||
By contrast, runtime errors are due to events beyond the scope of the program[.](#general-3.sentence-1)
|
||||
|
||||
They cannot be easily predicted in advance[.](#general-3.sentence-2)
|
||||
|
||||
The header <stdexcept> defines several types of predefined exceptions for reporting errors in a C++ program[.](#general-3.sentence-3)
|
||||
|
||||
These exceptions are related by inheritance[.](#general-3.sentence-4)
|
||||
|
||||
### [19.2.2](#stdexcept.syn) Header <stdexcept> synopsis [[stdexcept.syn]](stdexcept.syn)
|
||||
|
||||
[ð](#lib:logic_error)
|
||||
|
||||
namespace std {class logic_error; class domain_error; class invalid_argument; class length_error; class out_of_range; class runtime_error; class range_error; class overflow_error; class underflow_error;}
|
||||
|
||||
### [19.2.3](#logic.error) Class logic_error [[logic.error]](logic.error)
|
||||
|
||||
[ð](#lib:logic_error_)
|
||||
|
||||
namespace std {class logic_error : public exception {public:constexpr explicit logic_error(const string& what_arg); constexpr explicit logic_error(const char* what_arg); };}
|
||||
|
||||
[1](#logic.error-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L91)
|
||||
|
||||
The classlogic_error defines the type of objects thrown as
|
||||
exceptions to report errors presumably detectable before
|
||||
the program executes, such as violations of logical preconditions or class
|
||||
invariants[.](#logic.error-1.sentence-1)
|
||||
|
||||
[ð](#lib:logic_error,constructor)
|
||||
|
||||
`constexpr logic_error(const string& what_arg);
|
||||
`
|
||||
|
||||
[2](#logic.error-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L105)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg.c_str()) == 0[.](#logic.error-2.sentence-1)
|
||||
|
||||
[ð](#lib:logic_error,constructor_)
|
||||
|
||||
`constexpr logic_error(const char* what_arg);
|
||||
`
|
||||
|
||||
[3](#logic.error-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L116)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg) == 0[.](#logic.error-3.sentence-1)
|
||||
|
||||
### [19.2.4](#domain.error) Class domain_error [[domain.error]](domain.error)
|
||||
|
||||
[ð](#lib:domain_error_)
|
||||
|
||||
namespace std {class domain_error : public logic_error {public:constexpr explicit domain_error(const string& what_arg); constexpr explicit domain_error(const char* what_arg); };}
|
||||
|
||||
[1](#domain.error-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L134)
|
||||
|
||||
The classdomain_error defines the type of objects thrown as
|
||||
exceptions by the implementation to report domain errors[.](#domain.error-1.sentence-1)
|
||||
|
||||
[ð](#lib:domain_error,constructor)
|
||||
|
||||
`constexpr domain_error(const string& what_arg);
|
||||
`
|
||||
|
||||
[2](#domain.error-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L146)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg.c_str()) == 0[.](#domain.error-2.sentence-1)
|
||||
|
||||
[ð](#lib:domain_error,constructor_)
|
||||
|
||||
`constexpr domain_error(const char* what_arg);
|
||||
`
|
||||
|
||||
[3](#domain.error-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L157)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg) == 0[.](#domain.error-3.sentence-1)
|
||||
|
||||
### [19.2.5](#invalid.argument) Class invalid_argument [[invalid.argument]](invalid.argument)
|
||||
|
||||
[ð](#lib:invalid_argument_)
|
||||
|
||||
namespace std {class invalid_argument : public logic_error {public:constexpr explicit invalid_argument(const string& what_arg); constexpr explicit invalid_argument(const char* what_arg); };}
|
||||
|
||||
[1](#invalid.argument-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L175)
|
||||
|
||||
The classinvalid_argument defines the type of objects thrown as exceptions to report an invalid argument[.](#invalid.argument-1.sentence-1)
|
||||
|
||||
[ð](#lib:invalid_argument,constructor)
|
||||
|
||||
`constexpr invalid_argument(const string& what_arg);
|
||||
`
|
||||
|
||||
[2](#invalid.argument-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L186)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg.c_str()) == 0[.](#invalid.argument-2.sentence-1)
|
||||
|
||||
[ð](#lib:invalid_argument,constructor_)
|
||||
|
||||
`constexpr invalid_argument(const char* what_arg);
|
||||
`
|
||||
|
||||
[3](#invalid.argument-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L197)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg) == 0[.](#invalid.argument-3.sentence-1)
|
||||
|
||||
### [19.2.6](#length.error) Class length_error [[length.error]](length.error)
|
||||
|
||||
[ð](#lib:length_error_)
|
||||
|
||||
namespace std {class length_error : public logic_error {public:constexpr explicit length_error(const string& what_arg); constexpr explicit length_error(const char* what_arg); };}
|
||||
|
||||
[1](#length.error-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L215)
|
||||
|
||||
The classlength_error defines the type of objects thrown as exceptions
|
||||
to report an attempt to produce
|
||||
an object whose length exceeds its maximum allowable size[.](#length.error-1.sentence-1)
|
||||
|
||||
[ð](#lib:length_error,constructor)
|
||||
|
||||
`constexpr length_error(const string& what_arg);
|
||||
`
|
||||
|
||||
[2](#length.error-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L228)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg.c_str()) == 0[.](#length.error-2.sentence-1)
|
||||
|
||||
[ð](#lib:length_error,constructor_)
|
||||
|
||||
`constexpr length_error(const char* what_arg);
|
||||
`
|
||||
|
||||
[3](#length.error-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L239)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg) == 0[.](#length.error-3.sentence-1)
|
||||
|
||||
### [19.2.7](#out.of.range) Class out_of_range [[out.of.range]](out.of.range)
|
||||
|
||||
[ð](#lib:out_of_range_)
|
||||
|
||||
namespace std {class out_of_range : public logic_error {public:constexpr explicit out_of_range(const string& what_arg); constexpr explicit out_of_range(const char* what_arg); };}
|
||||
|
||||
[1](#out.of.range-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L257)
|
||||
|
||||
The classout_of_range defines the type of objects thrown as exceptions to report an
|
||||
argument value not in its expected range[.](#out.of.range-1.sentence-1)
|
||||
|
||||
[ð](#lib:out_of_range,constructor)
|
||||
|
||||
`constexpr out_of_range(const string& what_arg);
|
||||
`
|
||||
|
||||
[2](#out.of.range-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L270)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg.c_str()) == 0[.](#out.of.range-2.sentence-1)
|
||||
|
||||
[ð](#lib:out_of_range,constructor_)
|
||||
|
||||
`constexpr out_of_range(const char* what_arg);
|
||||
`
|
||||
|
||||
[3](#out.of.range-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L281)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg) == 0[.](#out.of.range-3.sentence-1)
|
||||
|
||||
### [19.2.8](#runtime.error) Class runtime_error [[runtime.error]](runtime.error)
|
||||
|
||||
[ð](#lib:runtime_error_)
|
||||
|
||||
namespace std {class runtime_error : public exception {public:constexpr explicit runtime_error(const string& what_arg); constexpr explicit runtime_error(const char* what_arg); };}
|
||||
|
||||
[1](#runtime.error-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L299)
|
||||
|
||||
The classruntime_error defines the type of objects thrown as exceptions to report errors presumably detectable only
|
||||
when the program executes[.](#runtime.error-1.sentence-1)
|
||||
|
||||
[ð](#lib:runtime_error,constructor)
|
||||
|
||||
`constexpr runtime_error(const string& what_arg);
|
||||
`
|
||||
|
||||
[2](#runtime.error-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L311)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg.c_str()) == 0[.](#runtime.error-2.sentence-1)
|
||||
|
||||
[ð](#lib:runtime_error,constructor_)
|
||||
|
||||
`constexpr runtime_error(const char* what_arg);
|
||||
`
|
||||
|
||||
[3](#runtime.error-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L322)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg) == 0[.](#runtime.error-3.sentence-1)
|
||||
|
||||
### [19.2.9](#range.error) Class range_error [[range.error]](range.error)
|
||||
|
||||
[ð](#lib:range_error_)
|
||||
|
||||
namespace std {class range_error : public runtime_error {public:constexpr explicit range_error(const string& what_arg); constexpr explicit range_error(const char* what_arg); };}
|
||||
|
||||
[1](#range.error-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L340)
|
||||
|
||||
The classrange_error defines the type of objects thrown as exceptions to report range errors
|
||||
in internal computations[.](#range.error-1.sentence-1)
|
||||
|
||||
[ð](#lib:range_error,constructor)
|
||||
|
||||
`constexpr range_error(const string& what_arg);
|
||||
`
|
||||
|
||||
[2](#range.error-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L352)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg.c_str()) == 0[.](#range.error-2.sentence-1)
|
||||
|
||||
[ð](#lib:range_error,constructor_)
|
||||
|
||||
`constexpr range_error(const char* what_arg);
|
||||
`
|
||||
|
||||
[3](#range.error-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L363)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg) == 0[.](#range.error-3.sentence-1)
|
||||
|
||||
### [19.2.10](#overflow.error) Class overflow_error [[overflow.error]](overflow.error)
|
||||
|
||||
[ð](#lib:overflow_error_)
|
||||
|
||||
namespace std {class overflow_error : public runtime_error {public:constexpr explicit overflow_error(const string& what_arg); constexpr explicit overflow_error(const char* what_arg); };}
|
||||
|
||||
[1](#overflow.error-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L381)
|
||||
|
||||
The classoverflow_error defines the type of objects thrown as exceptions to report an arithmetic overflow error[.](#overflow.error-1.sentence-1)
|
||||
|
||||
[ð](#lib:overflow_error,constructor)
|
||||
|
||||
`constexpr overflow_error(const string& what_arg);
|
||||
`
|
||||
|
||||
[2](#overflow.error-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L392)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg.c_str()) == 0[.](#overflow.error-2.sentence-1)
|
||||
|
||||
[ð](#lib:overflow_error,constructor_)
|
||||
|
||||
`constexpr overflow_error(const char* what_arg);
|
||||
`
|
||||
|
||||
[3](#overflow.error-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L403)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg) == 0[.](#overflow.error-3.sentence-1)
|
||||
|
||||
### [19.2.11](#underflow.error) Class underflow_error [[underflow.error]](underflow.error)
|
||||
|
||||
[ð](#lib:underflow_error_)
|
||||
|
||||
namespace std {class underflow_error : public runtime_error {public:constexpr explicit underflow_error(const string& what_arg); constexpr explicit underflow_error(const char* what_arg); };}
|
||||
|
||||
[1](#underflow.error-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L421)
|
||||
|
||||
The classunderflow_error defines the type of objects thrown as exceptions to report an arithmetic underflow error[.](#underflow.error-1.sentence-1)
|
||||
|
||||
[ð](#lib:underflow_error,constructor)
|
||||
|
||||
`constexpr underflow_error(const string& what_arg);
|
||||
`
|
||||
|
||||
[2](#underflow.error-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L432)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg.c_str()) == 0[.](#underflow.error-2.sentence-1)
|
||||
|
||||
[ð](#lib:underflow_error,constructor_)
|
||||
|
||||
`constexpr underflow_error(const char* what_arg);
|
||||
`
|
||||
|
||||
[3](#underflow.error-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L443)
|
||||
|
||||
*Postconditions*: strcmp(what(), what_arg) == 0[.](#underflow.error-3.sentence-1)
|
||||
38
cppdraft/std/exceptions/general.md
Normal file
38
cppdraft/std/exceptions/general.md
Normal file
@@ -0,0 +1,38 @@
|
||||
[std.exceptions.general]
|
||||
|
||||
# 19 Diagnostics library [[diagnostics]](./#diagnostics)
|
||||
|
||||
## 19.2 Exception classes [[std.exceptions]](std.exceptions#general)
|
||||
|
||||
### 19.2.1 General [std.exceptions.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L31)
|
||||
|
||||
The C++ standard library provides classes to be used to report certain errors ([[res.on.exception.handling]](res.on.exception.handling "16.4.6.14 Restrictions on exception handling")) in
|
||||
C++ programs[.](#1.sentence-1)
|
||||
|
||||
In the error model reflected in these classes, errors are divided into two
|
||||
broad categories:[*logic*](#def:logic) errors and[*runtime*](#def:runtime) errors[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L41)
|
||||
|
||||
The distinguishing characteristic of logic errors is that they are due to errors
|
||||
in the internal logic of the program[.](#2.sentence-1)
|
||||
|
||||
In theory, they are preventable[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L46)
|
||||
|
||||
By contrast, runtime errors are due to events beyond the scope of the program[.](#3.sentence-1)
|
||||
|
||||
They cannot be easily predicted in advance[.](#3.sentence-2)
|
||||
|
||||
The header <stdexcept> defines several types of predefined exceptions for reporting errors in a C++ program[.](#3.sentence-3)
|
||||
|
||||
These exceptions are related by inheritance[.](#3.sentence-4)
|
||||
469
cppdraft/std/ios/manip.md
Normal file
469
cppdraft/std/ios/manip.md
Normal file
@@ -0,0 +1,469 @@
|
||||
[std.ios.manip]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.5 Iostreams base classes [[iostreams.base]](iostreams.base#std.ios.manip)
|
||||
|
||||
### 31.5.5 ios_base manipulators [std.ios.manip]
|
||||
|
||||
#### [31.5.5.1](#fmtflags.manip) fmtflags manipulators [[fmtflags.manip]](fmtflags.manip)
|
||||
|
||||
[1](#fmtflags.manip-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2401)
|
||||
|
||||
Each function specified in this subclause
|
||||
is a designated addressable function ([[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"))[.](#fmtflags.manip-1.sentence-1)
|
||||
|
||||
[ð](#lib:boolalpha)
|
||||
|
||||
`ios_base& boolalpha(ios_base& str);
|
||||
`
|
||||
|
||||
[2](#fmtflags.manip-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2411)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::boolalpha)[.](#fmtflags.manip-2.sentence-1)
|
||||
|
||||
[3](#fmtflags.manip-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2416)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-3.sentence-1)
|
||||
|
||||
[ð](#lib:noboolalpha)
|
||||
|
||||
`ios_base& noboolalpha(ios_base& str);
|
||||
`
|
||||
|
||||
[4](#fmtflags.manip-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2427)
|
||||
|
||||
*Effects*: Callsstr.unsetf(ios_base::boolalpha)[.](#fmtflags.manip-4.sentence-1)
|
||||
|
||||
[5](#fmtflags.manip-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2432)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-5.sentence-1)
|
||||
|
||||
[ð](#lib:showbase)
|
||||
|
||||
`ios_base& showbase(ios_base& str);
|
||||
`
|
||||
|
||||
[6](#fmtflags.manip-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2443)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::showbase)[.](#fmtflags.manip-6.sentence-1)
|
||||
|
||||
[7](#fmtflags.manip-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2448)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-7.sentence-1)
|
||||
|
||||
[ð](#lib:noshowbase)
|
||||
|
||||
`ios_base& noshowbase(ios_base& str);
|
||||
`
|
||||
|
||||
[8](#fmtflags.manip-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2459)
|
||||
|
||||
*Effects*: Callsstr.unsetf(ios_base::showbase)[.](#fmtflags.manip-8.sentence-1)
|
||||
|
||||
[9](#fmtflags.manip-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2464)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-9.sentence-1)
|
||||
|
||||
[ð](#lib:showpoint)
|
||||
|
||||
`ios_base& showpoint(ios_base& str);
|
||||
`
|
||||
|
||||
[10](#fmtflags.manip-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2475)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::showpoint)[.](#fmtflags.manip-10.sentence-1)
|
||||
|
||||
[11](#fmtflags.manip-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2480)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-11.sentence-1)
|
||||
|
||||
[ð](#lib:noshowpoint)
|
||||
|
||||
`ios_base& noshowpoint(ios_base& str);
|
||||
`
|
||||
|
||||
[12](#fmtflags.manip-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2491)
|
||||
|
||||
*Effects*: Callsstr.unsetf(ios_base::showpoint)[.](#fmtflags.manip-12.sentence-1)
|
||||
|
||||
[13](#fmtflags.manip-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2496)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-13.sentence-1)
|
||||
|
||||
[ð](#lib:showpos)
|
||||
|
||||
`ios_base& showpos(ios_base& str);
|
||||
`
|
||||
|
||||
[14](#fmtflags.manip-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2507)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::showpos)[.](#fmtflags.manip-14.sentence-1)
|
||||
|
||||
[15](#fmtflags.manip-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2512)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-15.sentence-1)
|
||||
|
||||
[ð](#lib:noshowpos)
|
||||
|
||||
`ios_base& noshowpos(ios_base& str);
|
||||
`
|
||||
|
||||
[16](#fmtflags.manip-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2523)
|
||||
|
||||
*Effects*: Callsstr.unsetf(ios_base::showpos)[.](#fmtflags.manip-16.sentence-1)
|
||||
|
||||
[17](#fmtflags.manip-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2528)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-17.sentence-1)
|
||||
|
||||
[ð](#lib:skipws)
|
||||
|
||||
`ios_base& skipws(ios_base& str);
|
||||
`
|
||||
|
||||
[18](#fmtflags.manip-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2539)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::skipws)[.](#fmtflags.manip-18.sentence-1)
|
||||
|
||||
[19](#fmtflags.manip-19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2544)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-19.sentence-1)
|
||||
|
||||
[ð](#lib:noskipws)
|
||||
|
||||
`ios_base& noskipws(ios_base& str);
|
||||
`
|
||||
|
||||
[20](#fmtflags.manip-20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2555)
|
||||
|
||||
*Effects*: Callsstr.unsetf(ios_base::skipws)[.](#fmtflags.manip-20.sentence-1)
|
||||
|
||||
[21](#fmtflags.manip-21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2560)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-21.sentence-1)
|
||||
|
||||
[ð](#lib:uppercase)
|
||||
|
||||
`ios_base& uppercase(ios_base& str);
|
||||
`
|
||||
|
||||
[22](#fmtflags.manip-22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2571)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::uppercase)[.](#fmtflags.manip-22.sentence-1)
|
||||
|
||||
[23](#fmtflags.manip-23)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2576)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-23.sentence-1)
|
||||
|
||||
[ð](#lib:nouppercase)
|
||||
|
||||
`ios_base& nouppercase(ios_base& str);
|
||||
`
|
||||
|
||||
[24](#fmtflags.manip-24)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2587)
|
||||
|
||||
*Effects*: Callsstr.unsetf(ios_base::uppercase)[.](#fmtflags.manip-24.sentence-1)
|
||||
|
||||
[25](#fmtflags.manip-25)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2592)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-25.sentence-1)
|
||||
|
||||
[ð](#lib:unitbuf)
|
||||
|
||||
`ios_base& unitbuf(ios_base& str);
|
||||
`
|
||||
|
||||
[26](#fmtflags.manip-26)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2603)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::unitbuf)[.](#fmtflags.manip-26.sentence-1)
|
||||
|
||||
[27](#fmtflags.manip-27)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2608)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-27.sentence-1)
|
||||
|
||||
[ð](#lib:nounitbuf)
|
||||
|
||||
`ios_base& nounitbuf(ios_base& str);
|
||||
`
|
||||
|
||||
[28](#fmtflags.manip-28)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2619)
|
||||
|
||||
*Effects*: Callsstr.unsetf(ios_base::unitbuf)[.](#fmtflags.manip-28.sentence-1)
|
||||
|
||||
[29](#fmtflags.manip-29)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2624)
|
||||
|
||||
*Returns*: str[.](#fmtflags.manip-29.sentence-1)
|
||||
|
||||
#### [31.5.5.2](#adjustfield.manip) adjustfield manipulators [[adjustfield.manip]](adjustfield.manip)
|
||||
|
||||
[1](#adjustfield.manip-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2631)
|
||||
|
||||
Each function specified in this subclause
|
||||
is a designated addressable function ([[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"))[.](#adjustfield.manip-1.sentence-1)
|
||||
|
||||
[ð](#lib:internal)
|
||||
|
||||
`ios_base& internal(ios_base& str);
|
||||
`
|
||||
|
||||
[2](#adjustfield.manip-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2641)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::internal, ios_base::adjustfield)[.](#adjustfield.manip-2.sentence-1)
|
||||
|
||||
[3](#adjustfield.manip-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2646)
|
||||
|
||||
*Returns*: str[.](#adjustfield.manip-3.sentence-1)
|
||||
|
||||
[ð](#lib:left)
|
||||
|
||||
`ios_base& left(ios_base& str);
|
||||
`
|
||||
|
||||
[4](#adjustfield.manip-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2657)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::left, ios_base::adjustfield)[.](#adjustfield.manip-4.sentence-1)
|
||||
|
||||
[5](#adjustfield.manip-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2662)
|
||||
|
||||
*Returns*: str[.](#adjustfield.manip-5.sentence-1)
|
||||
|
||||
[ð](#lib:right)
|
||||
|
||||
`ios_base& right(ios_base& str);
|
||||
`
|
||||
|
||||
[6](#adjustfield.manip-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2673)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::right, ios_base::adjustfield)[.](#adjustfield.manip-6.sentence-1)
|
||||
|
||||
[7](#adjustfield.manip-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2678)
|
||||
|
||||
*Returns*: str[.](#adjustfield.manip-7.sentence-1)
|
||||
|
||||
#### [31.5.5.3](#basefield.manip) basefield manipulators [[basefield.manip]](basefield.manip)
|
||||
|
||||
[1](#basefield.manip-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2685)
|
||||
|
||||
Each function specified in this subclause
|
||||
is a designated addressable function ([[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"))[.](#basefield.manip-1.sentence-1)
|
||||
|
||||
[ð](#lib:dec)
|
||||
|
||||
`ios_base& dec(ios_base& str);
|
||||
`
|
||||
|
||||
[2](#basefield.manip-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2695)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::dec, ios_base::basefield)[.](#basefield.manip-2.sentence-1)
|
||||
|
||||
[3](#basefield.manip-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2700)
|
||||
|
||||
*Returns*: str[.](#basefield.manip-3.sentence-1)[265](#footnote-265 "The function signature dec(ios_base&) can be called by the function signature basic_ostream& stream::operator<<(ios_base& (*)(ios_base&)) to permit expressions of the form cout << dec to change the format flags stored in cout.")
|
||||
|
||||
[ð](#lib:hex)
|
||||
|
||||
`ios_base& hex(ios_base& str);
|
||||
`
|
||||
|
||||
[4](#basefield.manip-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2722)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::hex, ios_base::basefield)[.](#basefield.manip-4.sentence-1)
|
||||
|
||||
[5](#basefield.manip-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2727)
|
||||
|
||||
*Returns*: str[.](#basefield.manip-5.sentence-1)
|
||||
|
||||
[ð](#lib:oct)
|
||||
|
||||
`ios_base& oct(ios_base& str);
|
||||
`
|
||||
|
||||
[6](#basefield.manip-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2738)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::oct, ios_base::basefield)[.](#basefield.manip-6.sentence-1)
|
||||
|
||||
[7](#basefield.manip-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2743)
|
||||
|
||||
*Returns*: str[.](#basefield.manip-7.sentence-1)
|
||||
|
||||
[265)](#footnote-265)[265)](#footnoteref-265)
|
||||
|
||||
The function signaturedec(ios_base&) can be called by
|
||||
the function signaturebasic_ostream& stream::operator<<(ios_base& (*)(ios_base&)) to permit expressions of the formcout << dec to change the format flags stored incout[.](#footnote-265.sentence-1)
|
||||
|
||||
#### [31.5.5.4](#floatfield.manip) floatfield manipulators [[floatfield.manip]](floatfield.manip)
|
||||
|
||||
[1](#floatfield.manip-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2750)
|
||||
|
||||
Each function specified in this subclause
|
||||
is a designated addressable function ([[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"))[.](#floatfield.manip-1.sentence-1)
|
||||
|
||||
[ð](#lib:fixed)
|
||||
|
||||
`ios_base& fixed(ios_base& str);
|
||||
`
|
||||
|
||||
[2](#floatfield.manip-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2760)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::fixed, ios_base::floatfield)[.](#floatfield.manip-2.sentence-1)
|
||||
|
||||
[3](#floatfield.manip-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2765)
|
||||
|
||||
*Returns*: str[.](#floatfield.manip-3.sentence-1)
|
||||
|
||||
[ð](#lib:scientific)
|
||||
|
||||
`ios_base& scientific(ios_base& str);
|
||||
`
|
||||
|
||||
[4](#floatfield.manip-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2776)
|
||||
|
||||
*Effects*: Callsstr.setf(ios_base::scientific, ios_base::floatfield)[.](#floatfield.manip-4.sentence-1)
|
||||
|
||||
[5](#floatfield.manip-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2781)
|
||||
|
||||
*Returns*: str[.](#floatfield.manip-5.sentence-1)
|
||||
|
||||
[ð](#lib:hexfloat)
|
||||
|
||||
`ios_base& hexfloat(ios_base& str);
|
||||
`
|
||||
|
||||
[6](#floatfield.manip-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2792)
|
||||
|
||||
*Effects*: Calls str.setf(ios_base::fixed | ios_base::scientific,
|
||||
ios_base::floatfield)[.](#floatfield.manip-6.sentence-1)
|
||||
|
||||
[7](#floatfield.manip-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2797)
|
||||
|
||||
*Returns*: str[.](#floatfield.manip-7.sentence-1)
|
||||
|
||||
[8](#floatfield.manip-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2802)
|
||||
|
||||
[*Note [1](#floatfield.manip-note-1)*:
|
||||
|
||||
ios_base::hex cannot be used to specify
|
||||
a hexadecimal floating-point format,
|
||||
because it is not part of ios_base::floatfield (Table [137](ios.fmtflags#tab:ios.fmtflags.const "Table 137: fmtflags constants"))[.](#floatfield.manip-8.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:defaultfloat)
|
||||
|
||||
`ios_base& defaultfloat(ios_base& str);
|
||||
`
|
||||
|
||||
[9](#floatfield.manip-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2816)
|
||||
|
||||
*Effects*: Calls str.unsetf(ios_base::floatfield)[.](#floatfield.manip-9.sentence-1)
|
||||
|
||||
[10](#floatfield.manip-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L2820)
|
||||
|
||||
*Returns*: str[.](#floatfield.manip-10.sentence-1)
|
||||
54
cppdraft/std/iterator/tags.md
Normal file
54
cppdraft/std/iterator/tags.md
Normal file
@@ -0,0 +1,54 @@
|
||||
[std.iterator.tags]
|
||||
|
||||
# 24 Iterators library [[iterators]](./#iterators)
|
||||
|
||||
## 24.4 Iterator primitives [[iterator.primitives]](iterator.primitives#std.iterator.tags)
|
||||
|
||||
### 24.4.2 Standard iterator tags [std.iterator.tags]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2744)
|
||||
|
||||
It is often desirable for a
|
||||
function template specialization
|
||||
to find out what is the most specific category of its iterator
|
||||
argument, so that the function can select the most efficient algorithm at compile time[.](#1.sentence-1)
|
||||
|
||||
To facilitate this, the
|
||||
library introduces[*category tag*](#def:category_tag "24.4.2 Standard iterator tags [std.iterator.tags]") classes which are used as compile time tags for algorithm selection[.](#1.sentence-2)
|
||||
|
||||
They are:output_iterator_tag,input_iterator_tag,forward_iterator_tag,bidirectional_iterator_tag,random_access_iterator_tag,
|
||||
andcontiguous_iterator_tag[.](#1.sentence-3)
|
||||
|
||||
For every iterator of typeI,iterator_traits<I>::iterator_category shall be defined to be a category tag that describes the
|
||||
iterator's behavior[.](#1.sentence-4)
|
||||
|
||||
Additionally,iterator_traits<I>::iterator_concept may be used to indicate conformance to
|
||||
the iterator concepts ([[iterator.concepts]](iterator.concepts "24.3.4 Iterator concepts"))[.](#1.sentence-5)
|
||||
|
||||
namespace std {struct output_iterator_tag { }; struct input_iterator_tag { }; struct forward_iterator_tag: public input_iterator_tag { }; struct bidirectional_iterator_tag: public forward_iterator_tag { }; struct random_access_iterator_tag: public bidirectional_iterator_tag { }; struct contiguous_iterator_tag: public random_access_iterator_tag { };}
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2788)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
A program-defined iterator BinaryTreeIterator can be included into the bidirectional iterator category by
|
||||
specializing the iterator_traits template:template<class T> struct iterator_traits<BinaryTreeIterator<T>> {using iterator_category = bidirectional_iterator_tag; using difference_type = ptrdiff_t; using value_type = T; using pointer = T*; using reference = T&;};
|
||||
|
||||
â *end example*]
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2804)
|
||||
|
||||
[*Example [2](#example-2)*:
|
||||
|
||||
Ifevolve() is well-defined for bidirectional iterators, but can be implemented more
|
||||
efficiently for random access iterators, then the implementation is as follows:template<class BidirectionalIterator>inline void evolve(BidirectionalIterator first, BidirectionalIterator last) { evolve(first, last, typename iterator_traits<BidirectionalIterator>::iterator_category());}template<class BidirectionalIterator>void evolve(BidirectionalIterator first, BidirectionalIterator last,
|
||||
bidirectional_iterator_tag) {// more generic, but less efficient algorithm}template<class RandomAccessIterator>void evolve(RandomAccessIterator first, RandomAccessIterator last,
|
||||
random_access_iterator_tag) {// more efficient, but less generic algorithm}
|
||||
|
||||
â *end example*]
|
||||
118
cppdraft/std/manip.md
Normal file
118
cppdraft/std/manip.md
Normal file
@@ -0,0 +1,118 @@
|
||||
[std.manip]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.7 Formatting and manipulators [[iostream.format]](iostream.format#std.manip)
|
||||
|
||||
### 31.7.7 Standard manipulators [std.manip]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7192)
|
||||
|
||||
The header [<iomanip>](iomanip.syn#header:%3ciomanip%3e "31.7.3 Header <iomanip> synopsis [iomanip.syn]") defines several functions that support
|
||||
extractors and inserters that alter information maintained by classios_base and its derived classes[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:resetiosflags)
|
||||
|
||||
`unspecified resetiosflags(ios_base::fmtflags mask);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7203)
|
||||
|
||||
*Returns*: An object of
|
||||
unspecified type such that if out is an object of typebasic_ostream<charT, traits> then the expressionout << resetiosflags(mask) behaves as if it calledf(out, mask), or if in is an object of typebasic_istream<charT, traits> then the expressionin >> resetiosflags(mask) behaves as if it calledf(in, mask), where the function f is defined as:[291](#footnote-291 "The expression cin >> resetiosflags(ios_base::skipws) clears ios_base::skipws in the format flags stored in the basic_istream<charT, traits> object cin (the same as cin >> noskipws), and the expression cout << resetiosflags(ios_base::showbase) clears ios_base::showbase in the format flags stored in the basic_ostream<charT, traits> object cout (the same as cout << noshowbase).")void f(ios_base& str, ios_base::fmtflags mask) {// reset specified flags str.setf(ios_base::fmtflags(0), mask);}
|
||||
|
||||
The expression out << resetiosflags(mask) has
|
||||
type basic_ostream<charT, traits>& and value out[.](#2.sentence-2)
|
||||
|
||||
The
|
||||
expression in >> resetiosflags(mask) has typebasic_istream<charT, traits>& and value in[.](#2.sentence-3)
|
||||
|
||||
[ð](#lib:setiosflags)
|
||||
|
||||
`unspecified setiosflags(ios_base::fmtflags mask);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7242)
|
||||
|
||||
*Returns*: An object of unspecified type such that ifout is an object of typebasic_ostream<charT, traits> then the expressionout << setiosflags(mask) behaves as if it calledf(out, mask),
|
||||
or ifin is an object of typebasic_istream<charT, traits> then the expressionin >> setiosflags(mask) behaves as if it calledf(in, mask), where the function f is defined as:
|
||||
|
||||
[ð](#lib:fmtflags,ios_base)
|
||||
|
||||
void f(ios_base& str, ios_base::fmtflags mask) {// set specified flags str.setf(mask);}
|
||||
|
||||
The expressionout << setiosflags(mask) has typebasic_ostream<charT, traits>& and valueout[.](#3.sentence-2)
|
||||
|
||||
The expressionin >> setiosflags(mask) has typebasic_istream<charT, traits>& and valuein[.](#3.sentence-3)
|
||||
|
||||
[ð](#lib:setbase)
|
||||
|
||||
`unspecified setbase(int base);
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7288)
|
||||
|
||||
*Returns*: An object of unspecified type such that ifout is an object of typebasic_ostream<charT, traits> then the expressionout << setbase(base) behaves as if it calledf(out, base),
|
||||
or ifin is an object of typebasic_istream<charT, traits> then the expressionin >> setbase(base) behaves as if it calledf(in, base), where the function f is defined as:void f(ios_base& str, int base) {// set basefield str.setf(base == 8 ? ios_base::oct : base == 10 ? ios_base::dec : base == 16 ? ios_base::hex : ios_base::fmtflags(0), ios_base::basefield);}
|
||||
|
||||
The expressionout << setbase(base) has typebasic_ostream<charT, traits>& and valueout[.](#4.sentence-2)
|
||||
|
||||
The expressionin >> setbase(base) has typebasic_istream<charT, traits>& and valuein[.](#4.sentence-3)
|
||||
|
||||
[ð](#lib:setfill)
|
||||
|
||||
`unspecified setfill(char_type c);
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7336)
|
||||
|
||||
*Returns*: An object of unspecified type such that ifout is an object of typebasic_ostream<charT, traits> and c has typecharT then the expressionout << setfill(c) behaves as if it calledf(out, c), where the function f is defined as:template<class charT, class traits>void f(basic_ios<charT, traits>& str, charT c) {// set fill character str.fill(c);}
|
||||
|
||||
The expressionout << setfill(c) has typebasic_ostream<charT, traits>& and valueout[.](#5.sentence-2)
|
||||
|
||||
[ð](#lib:setprecision)
|
||||
|
||||
`unspecified setprecision(int n);
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7370)
|
||||
|
||||
*Returns*: An object of unspecified type such that ifout is an object of typebasic_ostream<charT, traits> then the expressionout << setprecision(n) behaves as if it calledf(out, n),
|
||||
or ifin is an object of typebasic_istream<charT, traits> then the expressionin >> setprecision(n) behaves as if it calledf(in, n), where the function f is defined as:void f(ios_base& str, int n) {// set precision str.precision(n);}
|
||||
|
||||
The expressionout << setprecision(n) has typebasic_ostream<charT, traits>& and valueout[.](#6.sentence-2)
|
||||
|
||||
The expressionin >> setprecision(n) has typebasic_istream<charT, traits>& and valuein[.](#6.sentence-3)
|
||||
|
||||
[ð](#lib:setw)
|
||||
|
||||
`unspecified setw(int n);
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7415)
|
||||
|
||||
*Returns*: An object of unspecified type such that ifout is an instance ofbasic_ostream<charT, traits> then the expressionout << setw(n) behaves as if it calledf(out, n),
|
||||
or ifin is an object of typebasic_istream<charT, traits> then the expressionin >> setw(n) behaves as if it calledf(in, n), where the function f is defined as:void f(ios_base& str, int n) {// set width str.width(n);}
|
||||
|
||||
The expressionout << setw(n) has typebasic_ostream<charT, traits>& and valueout[.](#7.sentence-2)
|
||||
|
||||
The expressionin >> setw(n) has typebasic_istream<charT, traits>& and valuein[.](#7.sentence-3)
|
||||
|
||||
[291)](#footnote-291)[291)](#footnoteref-291)
|
||||
|
||||
The expression cin >> resetiosflags(ios_base::skipws) clears ios_base::skipws in the format flags stored in thebasic_istream<charT, traits> object cin (the same ascin >> noskipws), and the expressioncout << resetiosflags(ios_base::showbase) clears ios_base::showbase in the
|
||||
format flags stored in the basic_ostream<charT, traits> objectcout (the same as cout << noshowbase)[.](#footnote-291.sentence-1)
|
||||
90
cppdraft/std/modules.md
Normal file
90
cppdraft/std/modules.md
Normal file
@@ -0,0 +1,90 @@
|
||||
[std.modules]
|
||||
|
||||
# 16 Library introduction [[library]](./#library)
|
||||
|
||||
## 16.4 Library-wide requirements [[requirements]](requirements#std.modules)
|
||||
|
||||
### 16.4.2 Library contents and organization [[organization]](organization#std.modules)
|
||||
|
||||
#### 16.4.2.4 Modules [std.modules]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1513)
|
||||
|
||||
The C++ standard library provides
|
||||
the following [*C++ library modules*](#def:C++_library_modules "16.4.2.4 Modules [std.modules]")[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1517)
|
||||
|
||||
The named module std exports declarations in namespace std that are provided by the importable C++ library headers
|
||||
(Table [24](headers#tab:headers.cpp "Table 24: C++ library headers") or the subset provided by a freestanding implementation)
|
||||
and the C++ headers for C library facilities (Table [25](headers#tab:headers.cpp.c "Table 25: C++ headers for C library facilities"))[.](#2.sentence-1)
|
||||
|
||||
It additionally exports declarations in the global namespace
|
||||
for the storage allocation and deallocation functions
|
||||
that are provided by [<new>](support.dynamic.general#header:%3cnew%3e "17.6.1 General [support.dynamic.general]")[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1526)
|
||||
|
||||
The named module std.compat exports the same declarations as
|
||||
the named module std, and
|
||||
additionally exports
|
||||
|
||||
- [(3.1)](#3.1)
|
||||
|
||||
declarations in the global namespace
|
||||
corresponding to the declarations in namespace std that are provided by
|
||||
the C++ headers for C library facilities (Table [25](headers#tab:headers.cpp.c "Table 25: C++ headers for C library facilities")),
|
||||
except the explicitly excluded declarations
|
||||
described in [[support.c.headers.other]](support.c.headers.other "17.15.7 Other C headers") and
|
||||
|
||||
- [(3.2)](#3.2)
|
||||
|
||||
declarations provided by
|
||||
the headers [<stdbit.h>](stdbit.h.syn#header:%3cstdbit.h%3e "22.12 Header <stdbit.h> synopsis [stdbit.h.syn]") and [<stdckdint.h>](stdckdint.h.syn#header:%3cstdckdint.h%3e "29.11.1 Header <stdckdint.h> synopsis [stdckdint.h.syn]")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1543)
|
||||
|
||||
It is unspecified to which module a declaration in the standard library
|
||||
is attached[.](#4.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Conforming implementations ensure that mixing#include and import does not result in
|
||||
conflicting attachments ([[basic.link]](basic.link "6.7 Program and linkage"))[.](#4.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
*Recommended practice*: Implementations should ensure such attachments do not preclude
|
||||
further evolution or decomposition of the standard library modules[.](#4.sentence-3)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1555)
|
||||
|
||||
A declaration in the standard library denotes the same entity regardless of
|
||||
whether it was made reachable through
|
||||
including a header,
|
||||
importing a header unit, or
|
||||
importing a C++ library module[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1562)
|
||||
|
||||
*Recommended practice*: Implementations should avoid exporting any other declarations
|
||||
from the C++ library modules[.](#6.sentence-1)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Like all named modules, the C++ library modules
|
||||
do not make macros visible ([[module.import]](module.import "10.3 Import declaration")), such asassert ([[cassert.syn]](cassert.syn "19.3.2 Header <cassert> synopsis")),errno ([[cerrno.syn]](cerrno.syn "19.4.2 Header <cerrno> synopsis")),offsetof ([[cstddef.syn]](cstddef.syn "17.2.1 Header <cstddef> synopsis")), andva_arg ([[cstdarg.syn]](cstdarg.syn "17.14.2 Header <cstdarg> synopsis"))[.](#6.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
Reference in New Issue
Block a user