[ Web Proxy ]
URL:
Viewing: http://ru.cppreference.com/cpp/string/basic_string/push_back [Back]  [Original]

std::basic_string<CharT,Traits,Allocator>::push_back cppreference.com
cppreference.com

std::basic_string<CharT,Traits,Allocator>::push_back

cppreference.com
 
C++
(C++20)
(C++20)
(C++11)
(C++20)
/
(C++11)
(C++11)
(C++11)
(C++17)
 
 
std::basic_string
-
(C++17)
,
/
( C++20)( C++20)( C++20)( C++20)( C++20)(C++20)
(C++11)(C++11)(C++11)
(C++11)(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
 
<tbody> </tbody> <tbody class="t-dcl-rev "> </tbody><tbody> </tbody>
void push_back( CharT ch );
( C++20)
constexpr void push_back( CharT ch );
( C++20)

ch .

ch

()

.

size() > max_size(), std::length_error.

- , ( ).

#include <iomanip>
#include <iostream>
#include <string>

int main()
{
    std::string str{" "};
    std::cout << "1) " << std::quoted(str) << ", : " << str.size() << '\n';
    
    str.push_back('!');
    std::cout << "2) " << std::quoted(str) << ", : " << str.size() << '\n';
}

:

1) " ", : 29
2) " !", : 30

C++:

LWG 7 C++98 (1) C++
(2) const CharT
(1)
(2) CharT
LWG 847 C++98


(public -) []

Web Proxy Viewer  |  New URL  |  Original Page