codecvt::max_length


public member function
int max_length ( ) const throw();

Return max length of one character

Returns the maximum amount of external characters needed for one internal character.

During its operation, this function simply calls the virtual protected member codecvt::do_max_length, which is the member function in charge of performing the actions described above.

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
19
// codecvt::max_length example
#include <iostream>
#include <locale>
using namespace std;

int main ()
{
  locale loc;

  cout << "max_length for codecvt<char,char,mbstate_t>: ";
  cout << use_facet<codecvt<char,char,mbstate_t> >(loc).max_length();
  cout << endl;

  cout << "max_length for codecvt<wchar_t,char,mbstate_t>: ";
  cout << use_facet<codecvt<wchar_t,char,mbstate_t> >(loc).max_length();
  cout << endl;

  return 0;
} 


Output:

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


See also