std::basic_string::insert
提供: cppreference.com
< cpp | string | basic string
![]() | このページは、Google 翻訳を使って英語版から機械翻訳されました。 翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
basic_string& insert( size_type index, size_type count, CharT ch ); | (1) | |
basic_string& insert( size_type index, const CharT* s ); | (2) | |
basic_string& insert( size_type index, const CharT* s, size_type count ); | (3) | |
basic_string& insert( size_type index, const basic_string& str ); | (4) | |
basic_string& insert( size_type index, const basic_string& str, size_type index_str, size_type count ); | (5) | |
iterator insert( iterator pos, CharT ch ); iterator insert( const_iterator pos, CharT ch ); | (6) | (C++11以前) (C++11およびそれ以降) |
void insert( iterator pos, size_type count, CharT ch ); iterator insert( iterator pos, size_type count, CharT ch ); | (7) | (C++11以前) (C++11およびそれ以降) |
template<class InputIt > void insert( iterator i, InputIt first, InputIt last ); | (8) | (C++11以前) (C++11およびそれ以降) |
iterator insert( const_iterator pos, std::initializer_list<CharT> ilist ); | (9) | (C++11およびそれ以降) |
挿入文字列に:
Original:
Inserts characters into the string:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
1)
挿入
count
位置ch
で文字index
のコピーOriginal:
Inserts
count
copies of character ch
at the position index
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2)
挿入するNULLで終わる文字列は位置
s
でindex
が指す。文字列の長さは、最初のnull文字によって決定されます(事実上のコールTraits::length(s). Original:
Inserts null-terminated character string pointed to by
s
at the position index
. The length of the string is determined by the first null character (effectively calls Traits::length(s). The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
3)
挿入位置
count
でs
が指す文字列の最初の文字をindex
。 s
はヌル文字を含めることができます.Original:
Inserts the first
count
characters from the character string pointed to by s
at the position index
. s
can contain null characters.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
4)
位置
str
に挿入した文字列index
Original:
Inserts string
str
at the position index
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
5)
位置str.substr(index_str, count)で
index
によって得られた文字列を挿入し、Original:
Inserts a string, obtained by str.substr(index_str, count) at the position
index
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
6)
ch
が指す文字の前に挿入した文字pos
Original:
Inserts character
ch
before the character pointed by pos
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
7)
挿入
count
要素がch
が指す前に文字pos
のコピーOriginal:
Inserts
count
copies of character ch
before the element pointed to by pos
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
8)
挿入範囲
[first, last)
から文字を Original:
Inserts characters from the range
[first, last)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
9)
初期化子リストから挿入要素
ilist
. Original:
Inserts elements from initializer list
ilist
. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集]パラメータ
index | - | コンテンツが挿入される位置 Original: position at which the content will be inserted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
pos | - | 文字が挿入される前に、イテレータ Original: iterator before which the characters will be inserted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
ch | - | 挿入する文字 Original: character to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
count | - | 挿入する文字の数 Original: number of characters to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
s | - | 挿入する文字列へのポインタ Original: pointer to the character string to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
str | - | 挿入する文字列 Original: string to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
first, last | - | 挿入する文字の範囲を定義する Original: range defining characters to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
index_str | - | 挿入する文字列の str の最初の文字の位置Original: position of the first character in the string str to insertThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
ilist | - | 初期化子は、リストから文字を挿入する Original: initializer list to insert the characters from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
型の要件 | ||
-InputIt は InputIterator の要求を満足しなければなりません。 |
[編集]値を返します
1-5)*this
6-9)
最後に挿入された文字の次のイテレータ.
Original:
Iterator following the last inserted character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集]例外
1)std::out_of_range if index > size() and std::length_error if size()+ count > max_size().
2)std::out_of_range if index > size() and std::length_error if size()+ Traits::length(s)> max_size().
3)std::out_of_range if index > size() and std::length_error if size()+ count > max_size().
4)
以下の条件に例外をスローします
Original:
Throws exceptions on the following conditions:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
a)std::out_of_range if index > size().
b)
std::length_error場合size()+ str.size()> max_size()
ins_count
が挿入される文字の数である.Original:
std::length_error if size()+ str.size()> max_size() where
ins_count
is the number of characters that will be inserted.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
5)
以下の条件に例外をスローします
Original:
Throws exceptions on the following conditions:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
a)std::out_of_range if index > size().
b)std::out_of_range if index_str > str.size().
c)
std::length_error場合size()+ ins_count > max_size()
ins_count
が挿入される文字の数である.Original:
std::length_error if size()+ ins_count > max_size() where
ins_count
is the number of characters that will be inserted.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
6-9) (なし)
[編集]参照
末尾に文字を追加します Original: appends characters to the end The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
末尾に追加文字 Original: appends a character to the end The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) |