A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/string/basic_string/pop_back/ below:

public member function

<string>

std::basic_string::pop_back

Delete last character

Erases the last character of the basic_string, effectively reducing its length by one.

Parameters none

Return value none

Example
1
2
3
4
5
6
7
8
9
10
11
// string::pop_back
#include <iostream>
#include <string>

int main ()
{
  std::string str ("hello world!");
  str.pop_back();
  std::cout << str << '\n';
  return 0;
}



Complexity Unspecified, but generally constant.

Iterator validity Any iterators, pointers and references related to this object may be invalidated.

Data races The object is modified.

Exception safety If the basic_string is empty, it causes undefined behavior.
Otherwise, the function never throws exceptions (no-throw guarantee).

See also
basic_string::back
Access last character (public member function)
basic_string::push_back
Append character to string (public member function)
basic_string::erase
Erase characters from string (public member function)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4