Difference between revisions of "cpp/string/basic string/resize"
From cppreference.com
< cpp | string | basic string
m (Text replace - "{{complex}}" to "===Complexity===") |
m (Text replace - "<!-- ======== --> " to "") |
||
Line 18: | Line 18: | ||
The first version initializes new characters to {{cpp|CharT()}}, the second version initializes new characters to {{tt|ch}}. | The first version initializes new characters to {{cpp|CharT()}}, the second version initializes new characters to {{tt|ch}}. | ||
− | |||
===Parameters=== | ===Parameters=== | ||
Line 26: | Line 25: | ||
{{param list end}} | {{param list end}} | ||
− | |||
===Return value=== | ===Return value=== | ||
{{return none}} | {{return none}} | ||
− | |||
===Complexity=== | ===Complexity=== | ||
linear in the size of the string | linear in the size of the string | ||
− | |||
===See also=== | ===See also=== | ||
Revision as of 19:17, 2 August 2011
Template:cpp/string/basic string/sidebar Template:ddcl list begin <tr class="t-dcl ">
<td >void resize( size_type count );
</td>
<td > (1) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">
<td >void resize( size_type count, CharT ch );
</td>
<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end
Resizes the string to contain count
characters.
If the current size is less than count
, additional characters are appended.
If the current size is greater than count
, the string is reduced to its first count
elements.
The first version initializes new characters to Template:cpp, the second version initializes new characters to ch
.
Contents |
Parameters
count | - | new size of the string |
ch | - | character to initialize the new characters with |
Return value
Complexity
linear in the size of the string