From Jason Turner

[stringbuf.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1qq5l1s6/{from.md → to.md} +67 -19
tmp/tmp1qq5l1s6/{from.md → to.md} RENAMED
@@ -1,42 +1,88 @@
1
- #### `basic_stringbuf` constructors <a id="stringbuf.cons">[[stringbuf.cons]]</a>
2
 
3
  ``` cpp
4
- explicit basic_stringbuf(
5
- ios_base::openmode which = ios_base::in | ios_base::out);
6
  ```
7
 
8
- *Effects:* Constructs an object of class `basic_stringbuf`, initializing
9
- the base class with `basic_streambuf()` ([[streambuf.cons]]), and
10
- initializing `mode` with `which`.
 
 
11
 
12
- *Postconditions:* `str() == ""`.
13
 
14
  ``` cpp
15
  explicit basic_stringbuf(
16
  const basic_string<charT, traits, Allocator>& s,
17
  ios_base::openmode which = ios_base::in | ios_base::out);
18
  ```
19
 
20
- *Effects:* Constructs an object of class `basic_stringbuf`, initializing
21
- the base class with `basic_streambuf()` ([[streambuf.cons]]), and
22
- initializing `mode` with `which`. Then calls `str(s)`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  ``` cpp
25
  basic_stringbuf(basic_stringbuf&& rhs);
 
26
  ```
27
 
28
- *Effects:* Move constructs from the rvalue `rhs`. It is
29
- *implementation-defined* whether the sequence pointers in `*this`
30
- (`eback()`, `gptr()`, `egptr()`, `pbase()`, `pptr()`, `epptr()`) obtain
31
- the values which `rhs` had. Whether they do or not, `*this` and `rhs`
32
- reference separate buffers (if any at all) after the construction. The
33
- openmode, locale and any other state of `rhs` is also copied.
34
 
35
- *Postconditions:* Let `rhs_p` refer to the state of `rhs` just prior to
36
- this construction and let `rhs_a` refer to the state of `rhs` just after
37
- this construction.
38
 
39
  - `str() == rhs_p.str()`
40
  - `gptr() - eback() == rhs_p.gptr() - rhs_p.eback()`
41
  - `egptr() - eback() == rhs_p.egptr() - rhs_p.eback()`
42
  - `pptr() - pbase() == rhs_p.pptr() - rhs_p.pbase()`
@@ -45,6 +91,8 @@ this construction.
45
  - `if (gptr()) gptr() != rhs_a.gptr()`
46
  - `if (egptr()) egptr() != rhs_a.egptr()`
47
  - `if (pbase()) pbase() != rhs_a.pbase()`
48
  - `if (pptr()) pptr() != rhs_a.pptr()`
49
  - `if (epptr()) epptr() != rhs_a.epptr()`
 
 
50
 
 
1
+ #### Constructors <a id="stringbuf.cons">[[stringbuf.cons]]</a>
2
 
3
  ``` cpp
4
+ explicit basic_stringbuf(ios_base::openmode which);
 
5
  ```
6
 
7
+ *Effects:* Initializes the base class with `basic_streambuf()`
8
+ [[streambuf.cons]], and `mode` with `which`. It is
9
+ *implementation-defined* whether the sequence pointers (`eback()`,
10
+ `gptr()`, `egptr()`, `pbase()`, `pptr()`, `epptr()`) are initialized to
11
+ null pointers.
12
 
13
+ *Ensures:* `str().empty()` is `true`.
14
 
15
  ``` cpp
16
  explicit basic_stringbuf(
17
  const basic_string<charT, traits, Allocator>& s,
18
  ios_base::openmode which = ios_base::in | ios_base::out);
19
  ```
20
 
21
+ *Effects:* Initializes the base class with `basic_streambuf()`
22
+ [[streambuf.cons]], `mode` with `which`, and `buf` with `s`, then calls
23
+ `init_buf_ptrs()`.
24
+
25
+ ``` cpp
26
+ basic_stringbuf(ios_base::openmode which, const Allocator &a);
27
+ ```
28
+
29
+ *Effects:* Initializes the base class with `basic_streambuf()`
30
+ [[streambuf.cons]], `mode` with `which`, and `buf` with `a`, then calls
31
+ `init_buf_ptrs()`.
32
+
33
+ *Ensures:* `str().empty()` is `true`.
34
+
35
+ ``` cpp
36
+ explicit basic_stringbuf(
37
+ basic_string<charT, traits, Allocator>&& s,
38
+ ios_base::openmode which = ios_base::in | ios_base::out);
39
+ ```
40
+
41
+ *Effects:* Initializes the base class with `basic_streambuf()`
42
+ [[streambuf.cons]], `mode` with `which`, and `buf` with `std::move(s)`,
43
+ then calls `init_buf_ptrs()`.
44
+
45
+ ``` cpp
46
+ template<class SAlloc>
47
+ basic_stringbuf(
48
+ const basic_string<charT, traits, SAlloc>& s,
49
+ ios_base::openmode which, const Allocator &a);
50
+ ```
51
+
52
+ *Effects:* Initializes the base class with `basic_streambuf()`
53
+ [[streambuf.cons]], `mode` with `which`, and `buf` with `{s,a}`, then
54
+ calls `init_buf_ptrs()`.
55
+
56
+ ``` cpp
57
+ template<class SAlloc>
58
+ explicit basic_stringbuf(
59
+ const basic_string<charT, traits, SAlloc>& s,
60
+ ios_base::openmode which = ios_base::in | ios_base::out);
61
+ ```
62
+
63
+ *Constraints:* `is_same_v<SAlloc,Allocator>` is `false`.
64
+
65
+ *Effects:* Initializes the base class with `basic_streambuf()`
66
+ [[streambuf.cons]], `mode` with `which`, and `buf` with `s`, then calls
67
+ `init_buf_ptrs()`.
68
 
69
  ``` cpp
70
  basic_stringbuf(basic_stringbuf&& rhs);
71
+ basic_stringbuf(basic_stringbuf&& rhs, const Allocator& a);
72
  ```
73
 
74
+ *Effects:* Copy constructs the base class from `rhs` and initializes
75
+ `mode` with `rhs.mode`. In the first form `buf` is initialized from
76
+ `std::move(rhs).str()`. In the second form `buf` is initialized from
77
+ `{std::move(rhs).str(), a}`. It is *implementation-defined* whether the
78
+ sequence pointers in `*this` (`eback()`, `gptr()`, `egptr()`, `pbase()`,
79
+ `pptr()`, `epptr()`) obtain the values which `rhs` had.
80
 
81
+ *Ensures:* Let `rhs_p` refer to the state of `rhs` just prior to this
82
+ construction and let `rhs_a` refer to the state of `rhs` just after this
83
+ construction.
84
 
85
  - `str() == rhs_p.str()`
86
  - `gptr() - eback() == rhs_p.gptr() - rhs_p.eback()`
87
  - `egptr() - eback() == rhs_p.egptr() - rhs_p.eback()`
88
  - `pptr() - pbase() == rhs_p.pptr() - rhs_p.pbase()`
 
91
  - `if (gptr()) gptr() != rhs_a.gptr()`
92
  - `if (egptr()) egptr() != rhs_a.egptr()`
93
  - `if (pbase()) pbase() != rhs_a.pbase()`
94
  - `if (pptr()) pptr() != rhs_a.pptr()`
95
  - `if (epptr()) epptr() != rhs_a.epptr()`
96
+ - `getloc() == rhs_p.getloc()`
97
+ - `rhs` is empty but usable, as if `std::move(rhs).str()` was called.
98