A RetroSearch Logo

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

Search Query:

Showing content from https://cplusplus.com/reference/locale/codecvt/max_length/ below:

public member function

<locale>

std::codecvt::max_length
int max_length() const throw();
int max_length() const noexcept;

Return max length of one character

Returns the maximum number of internal characters needed for an external character.

Internally, this function simply calls the virtual protected member do_max_length</samp to produce its result.


Parameters none

Return value The maximum length of one external character if translated to internal characters.

Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// codecvt::max_length example
#include <iostream>       // std::cout
#include <locale>         // std::locale, std::codecvt, std::use_facet

int main ()
{
  std::locale loc;

  std::cout << "max_length for codecvt<char,char,mbstate_t>: ";
  std::cout << std::use_facet<std::codecvt<char,char,mbstate_t> >(loc).max_length();
  std::cout << '\n';

  std::cout << "max_length for codecvt<wchar_t,char,mbstate_t>: ";
  std::cout << std::use_facet<std::codecvt<wchar_t,char,mbstate_t> >(loc).max_length();
  std::cout << '\n';

  return 0;
}

Possible output:
max_length for codecvt<char,char,mbstate_t>: 1
max_length for codecvt<wchar_t,char,mbstate_t>: 5


Data races The facet object is accessed.

Exception safetyNo-throw guarantee: never throws exceptions.

See also
codecvt::encoding
Return encoding width (public member function)
codecvt::length
Return length of translated sequence (public member function)
codecvt::do_max_length
Return max length of one character [virtual] (protected virtual 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