GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::basic_string::push_back(3) C++ Standard Libary std::basic_string::push_back(3)

std::basic_string::push_back - std::basic_string::push_back


void push_back( CharT ch ); (until C++20)
constexpr void push_back( CharT ch ); (since C++20)


Appends the given character ch to the end of the string.


ch - the character to append


(none)


Amortized constant.


If an exception is thrown for any reason, this function has no effect (strong
exception guarantee).
(since C++11)


If the operation would result in size() > max_size(), throws std::length_error.

// Run this code


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


int main()
{
std::string str{"Short string"};
std::cout << "before=" << std::quoted(str) << '\n';
assert(str.size() == 12);


str.push_back('!');
std::cout << " after=" << quoted(str) << '\n';
assert(str.size() == 13);
}


before="Short string"
after="Short string!"


pop_back removes the last character
(C++11) (public member function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.