state is also updated as if codecvt::in was called for a buffer of max internal characters.
During its operation, this function simply calls the virtual protected member codecvt::do_length, which is the member function in charge of performing the actions described above.
Parameters
- state
- State object to keep track of the state of a multibyte character conversion. Typically, this is an object of type mbstate_t.
stateT is the state type (i.e., the third template parameter of codecvt).
- from, from_end
- Pointer to the initial and final characters of the source sequence. The range used is [from,from_end), which contains all the characters between from and from_end, including the character pointed by from but not the character pointed by from_end.
externT is the external character type (i.e., the second template parameter of codecvt). - max
- Maximum length of the translated sequence (in terms of internal characters).
size_t is an integral type.
Return value
The length of the sequence of characters 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 20 21 22 23 24 25 26 27 28 |
|
Output:
A string of 10 wchar_t elements: abcdefghij |
See also
| codecvt::in | Translate in characters (public member function) |
| codecvt::max_length | Return max length of one character (public member function) |
| codecvt::do_length | Return length of translated sequence [virtual] (public member function) |
