Skip to content

Commit

Permalink
add link to streambuf.
Browse files Browse the repository at this point in the history
some improvements in string_view
  • Loading branch information
suomesta committed Feb 4, 2024
1 parent c576264 commit 3d75aee
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion reference/fstream/basic_filebuf.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Cの`FILE*`に対する入出力関数を使って実装される。
| `sync` | 出力列の同期 (protected virtual) | |
| `uflow` | (protected virtual) |
| `underflow` | (protected virtual) |
| `showmasync` | ブロックせずに読み取れると期待される文字数を得る (protected virtual) | |
| `showmanyc` | ブロックせずに読み取れると期待される文字数を得る (protected virtual) | |
| `pbackfail` | 1文字を入力列に戻す (protected virtual) | |
| `overflow` | (protected virtual) |
Expand Down
2 changes: 1 addition & 1 deletion reference/istream/basic_istream/peek.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ int_type peek() {
## 参照

- [`basic_istream::get`](get.md)
- `basic_streambuf::sgetc`
- [`basic_streambuf::sgetc`](../../streambuf/basic_streambuf/sgetc.md)
2 changes: 1 addition & 1 deletion reference/istream/basic_istream/putback.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ basic_istream<CharT, Traits>& putback(char_type c) {
## 参照

- [`basic_istream::unget`](unget.md)
- `basic_streambuf::sputbackc`
- [`basic_streambuf::sputbackc`](../../streambuf/basic_streambuf/sputbackc.md)
8 changes: 4 additions & 4 deletions reference/istream/basic_istream/seekg.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ basic_istream<CharT, Traits>& seekg(off_type off, seekdir dir) {
## 参照
- [`basic_istream::tellg`](tellg.md)
- `basic_streambuf::pubseekpos`
- `basic_streambuf::pubseekoff`
- `basic_streambuf::seekpos`
- `basic_streambuf::seekoff`
- [`basic_streambuf::pubseekpos`](../../streambuf/basic_streambuf/pubseekpos.md)
- [`basic_streambuf::pubseekoff`](../../streambuf/basic_streambuf/pubseekoff.md)
- [`basic_streambuf::seekpos`](../../streambuf/basic_streambuf/seekpos.md)
- [`basic_streambuf::seekoff`](../../streambuf/basic_streambuf/seekoff.md)
3 changes: 1 addition & 2 deletions reference/istream/basic_istream/sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,4 @@ int sync() {
- C++98

## 参照

- `basic_streambuf::pubsync`
- [`basic_streambuf::pubsync`](../../streambuf/basic_streambuf/pubsync.md)
5 changes: 2 additions & 3 deletions reference/istream/basic_istream/tellg.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ pos_type tellg(pos_type pos) {
- C++98
## 参照
- [`basic_istream::seekg`](seekg.md)
- `basic_streambuf::pubseekoff`
- `basic_streambuf::seekoff`
- [`basic_streambuf::pubseekoff`](../../streambuf/basic_streambuf/pubseekoff.md)
- [`basic_streambuf::seekoff`](../../streambuf/basic_streambuf/seekoff.md)
2 changes: 1 addition & 1 deletion reference/istream/basic_istream/unget.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ basic_istream<CharT, Traits>& unget() {
## 参照

- [`basic_istream::putback`](putback.md)
- `basic_streambuf::sungetc`
- [`basic_streambuf::sungetc`](../../streambuf/basic_streambuf/sungetc.md)
2 changes: 1 addition & 1 deletion reference/string/basic_string.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ namespace std {
| 名前 | 説明 | 対応バージョン |
|---------------------|----------------|------|
| `npos` | 無効な位置を表す。`find`や`substr`などで使われる。<br/>`static const size_type npos = -1;` | |
| `npos` | 無効な位置を表す。`find`や`substr`などで使われる。<br/>`static const size_type npos = -1;` | C++23からconstexpr |
### メンバ型
Expand Down
4 changes: 2 additions & 2 deletions reference/string_view/basic_string_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ string_view hello = sv.substr(0, 5); // 先頭5文字を抽出する

| 名前 | 説明 | 対応バージョン |
|---------------------|----------------|------|
| `npos` | 無効な位置を表す。`find``substr`などで使われる。<br/>`static const size_type npos = -1;` | C++17 |
| `npos` | 無効な位置を表す。`find``substr`などで使われる。<br/>`static constexpr size_type npos = -1;` | C++17 |


### メンバ型
Expand Down Expand Up @@ -260,7 +260,7 @@ Hell
```
### 文字列リテラルを範囲として使用する場合にヌル文字が含まれないようにする
```cpp
```cpp example
#include <iostream>
#include <string_view>
Expand Down
14 changes: 7 additions & 7 deletions reference/string_view/basic_string_view/compare.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ constexpr int compare(size_type pos1,
## 概要
他の文字列との比較を行う。
- (1) : `*this`と`s`を比較する
- (2) : `*this`の範囲`[pos1, pos1 + n1)`と`s`を比較する
- (3) : `*this`の範囲`[pos1, pos1 + n1)`と`s`の範囲`[pos2, pos2 + n2)`を比較する
- (1) : `*this`と`sv`を比較する
- (2) : `*this`の範囲`[pos1, pos1 + n1)`と`sv`を比較する
- (3) : `*this`の範囲`[pos1, pos1 + n1)`と`sv`の範囲`[pos2, pos2 + n2)`を比較する
- (4) : `*this`と文字配列`s`を比較する
- (5) : `*this`の範囲`[pos1, pos1 + n1)`と文字配列`s`を比較する
- (6) : `*this`の範囲`[pos1, pos1 + n1)`と文字配列`s`の先頭`n2`文字を比較する
## 効果
- (1) :
- [`size()`](size.md)と`str.`[`size()`](size.md)のうち、小さい方を`rlen`とする
- [`size()`](size.md)と`sv.`[`size()`](size.md)のうち、小さい方を`rlen`とする
- `int result = Traits::`[`compare`](/reference/string/char_traits/compare.md)`(`[`data()`](data.md)`, sv.`[`data()`](data.md)`, rlen);`
- `result != 0`であれば`result`を返す。そうでなければ、以下のように返す:
- `size() < str.size()`であれば0未満の値を返す
- `size() == str.size()`であれば0を返す
- `size() > str.size()`であれば0超の値を返す
- `size() < sv.size()`であれば0未満の値を返す
- `size() == sv.size()`であれば0を返す
- `size() > sv.size()`であれば0超の値を返す
- (2) : `return` [`substr`](substr.md)`(pos1, n1).compare(sv);` と等価
- (3) : `return` [`substr`](substr.md)`(pos1, n1).compare(sv.`[`substr`](substr.md)`(pos2, n2));` と等価
- (4) : `return compare(basic_string_view(s));` と等価
Expand Down

0 comments on commit 3d75aee

Please sign in to comment.